Link to database cannot be established: SQLSTATE[HY000] [2002] Connection refused
at line 119 in file classes/db/DbPDO.php
114. public function connect()
115. {
116. try {
117. $this->link = $this->getPDO($this->server, $this->user, $this->password, $this->database, 5);
118. } catch (PDOException $e) {
119. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage());
120. }
121.
122. $this->link->exec('SET SESSION sql_mode = \'\'');
123.
124. return $this->link;
375. }
376.
377. $this->result = $this->_query($sql);
378.
379. if (!$this->result && $this->getNumberError() == 2006) {
380. $this->connect();
381. $this->result = $this->_query($sql);
382. }
383.
384. if (_PS_DEBUG_SQL_) {
385. $this->displayError($sql);
655.
656. return $result;
657. }
658. }
659.
660. $this->result = $this->query($sql);
661. if (!$this->result) {
662. $result = false;
663. } else {
664. $result = $this->nextRow($this->result);
665. }
Argument [0] SELECT 1 FROM `ps_4ftPiMT1_cart_rule` WHERE ((date_to >= "2026-06-25 00:00:00" AND date_to = "2026-06-25 00:00:00" AND date_from "2026-06-25 23:59:59")) AND `id_customer` IN (0,0) LIMIT 1
689. {
690. if ($sql instanceof DbQuery) {
691. $sql = $sql->build();
692. }
693.
694. $result = $this->getRow($sql, $use_cache);
695. if (false === $result) {
696. return false;
697. }
698.
699. return array_shift($result);
Argument [0] SELECT 1 FROM `ps_4ftPiMT1_cart_rule` WHERE ((date_to >= "2026-06-25 00:00:00" AND date_to = "2026-06-25 00:00:00" AND date_from "2026-06-25 23:59:59")) AND `id_customer` IN (0,0) LIMIT 1 Argument [1] 1
352. '" AND date_from <= "' . $end_date .
353. '") OR (date_from < "' . $start_date .
354. '" AND date_to > "' . $end_date .
355. '")) AND `id_customer` IN (0,' . (int) $idCustomer . ')';
356.
357. $haveCartRuleToday[$idCustomer] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
358. }
359.
360. return !empty($haveCartRuleToday[$idCustomer]);
361. }
362.
Argument [0] SELECT 1 FROM `ps_4ftPiMT1_cart_rule` WHERE ((date_to >= "2026-06-25 00:00:00" AND date_to = "2026-06-25 00:00:00" AND date_from "2026-06-25 23:59:59")) AND `id_customer` IN (0,0)
384. $inStock = false,
385. CartCore $cart = null,
386. $free_shipping_only = false,
387. $highlight_only = false
388. ) {
389. if (!CartRule::isFeatureActive() || !CartRule::haveCartRuleToday($id_customer)) {
390. return [];
391. }
392.
393. $sql_part1 = '* FROM `' . _DB_PREFIX_ . 'cart_rule` cr
394. LEFT JOIN `' . _DB_PREFIX_ . 'cart_rule_lang` crl ON (cr.`id_cart_rule` = crl.`id_cart_rule` AND crl.`id_lang` = ' . (int) $id_lang . ')';
Argument [0] 0
3016. (int) Context::getContext()->cookie->id_customer,
3017. true,
3018. true,
3019. false,
3020. $this,
3021. true
3022. );
3023.
3024. $result = false;
3025. if ($this->id) {
3026. $result = Db::getInstance()->executeS('SELECT * FROM ' . _DB_PREFIX_ . 'cart_cart_rule WHERE id_cart = ' . (int) $this->id);
Argument [0]
2
Argument [1]
0
Argument [2]
1
Argument [3]
1
Argument [4]
Argument [5]
Cart Object
(
[id] =>
[id_shop_group] =>
[id_shop] =>
[id_address_delivery] =>
[id_address_invoice] =>
[id_currency] =>
[id_customer] =>
[id_guest] =>
[id_lang] =>
[recyclable] =>
[gift] =>
[gift_message] =>
[mobile_theme] =>
[date_add] =>
[secure_key] =>
[id_carrier] => 0
[date_upd] =>
[checkedTos] =>
[pictures] =>
[textFields] =>
[delivery_option] =>
[allow_seperated_package] =>
[_products:protected] =>
[_taxCalculationMethod:protected] => 0
[webserviceParameters:protected] => Array
(
[fields] => Array
(
[id_address_delivery] => Array
(
[xlink_resource] => addresses
)
[id_address_invoice] => Array
(
[xlink_resource] => addresses
)
[id_currency] => Array
(
[xlink_resource] => currencies
)
[id_customer] => Array
(
[xlink_resource] => customers
)
[id_guest] => Array
(
[xlink_resource] => guests
)
[id_lang] => Array
(
[xlink_resource] => languages
)
)
[associations] => Array
(
[cart_rows] => Array
(
[resource] => cart_row
[virtual_entity] => 1
[fields] => Array
(
[id_product] => Array
(
[required] => 1
[xlink_resource] => products
)
[id_product_attribute] => Array
(
[required] => 1
[xlink_resource] => combinations
)
[id_address_delivery] => Array
(
[required] => 1
[xlink_resource] => addresses
)
[id_customization] => Array
(
[required] =>
[xlink_resource] => customizations
)
[quantity] => Array
(
[required] => 1
)
)
)
)
)
[configuration:protected] => PrestaShop\PrestaShop\Adapter\Configuration Object
(
[shop:PrestaShop\PrestaShop\Adapter\Configuration:private] =>
[parameters:protected] =>
)
[addressFactory:protected] => PrestaShop\PrestaShop\Adapter\AddressFactory Object
(
)
[shouldSplitGiftProductsQuantity:protected] =>
[shouldExcludeGiftsDiscount:protected] =>
[lang_associated:protected] =>
[id_shop_list] => Array
(
)
[get_shop_from_context:protected] => 1
[table:protected] => cart
[identifier:protected] => id_cart
[fieldsRequired:protected] => Array
(
[0] => id_currency
[1] => id_lang
)
[fieldsSize:protected] => Array
(
[secure_key] => 32
)
[fieldsValidate:protected] => Array
(
[id_shop_group] => isUnsignedId
[id_shop] => isUnsignedId
[id_address_delivery] => isUnsignedId
[id_address_invoice] => isUnsignedId
[id_carrier] => isUnsignedId
[id_currency] => isUnsignedId
[id_customer] => isUnsignedId
[id_guest] => isUnsignedId
[id_lang] => isUnsignedId
[recyclable] => isBool
[gift] => isBool
[gift_message] => isMessage
[mobile_theme] => isBool
[allow_seperated_package] => isBool
[date_add] => isDate
[date_upd] => isDate
)
[fieldsRequiredLang:protected] => Array
(
)
[fieldsSizeLang:protected] => Array
(
)
[fieldsValidateLang:protected] => Array
(
)
[tables:protected] => Array
(
)
[image_dir:protected] =>
[image_format:protected] => jpg
[translator:protected] =>
[def:protected] => Array
(
[table] => cart
[primary] => id_cart
[fields] => Array
(
[id_shop_group] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_shop] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_address_delivery] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_address_invoice] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_carrier] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_currency] => Array
(
[type] => 1
[validate] => isUnsignedId
[required] => 1
)
[id_customer] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_guest] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_lang] => Array
(
[type] => 1
[validate] => isUnsignedId
[required] => 1
)
[recyclable] => Array
(
[type] => 2
[validate] => isBool
)
[gift] => Array
(
[type] => 2
[validate] => isBool
)
[gift_message] => Array
(
[type] => 3
[validate] => isMessage
)
[mobile_theme] => Array
(
[type] => 2
[validate] => isBool
)
[delivery_option] => Array
(
[type] => 3
)
[secure_key] => Array
(
[type] => 3
[size] => 32
)
[allow_seperated_package] => Array
(
[type] => 2
[validate] => isBool
)
[date_add] => Array
(
[type] => 5
[validate] => isDate
)
[date_upd] => Array
(
[type] => 5
[validate] => isDate
)
)
[classname] => Cart
)
[update_fields:protected] =>
[force_id] =>
)
Argument [6]
1
3400. $cache_id = (int) (is_object($default_country) ? $default_country->id : 0) . '-' . (int) $dontAutoSelectOptions;
3401. if (isset(static::$cacheDeliveryOption[$cache_id]) && $use_cache) {
3402. return static::$cacheDeliveryOption[$cache_id];
3403. }
3404.
3405. $delivery_option_list = $this->getDeliveryOptionList($default_country);
3406.
3407. // The delivery option was selected
3408. if (isset($this->delivery_option) && $this->delivery_option != '') {
3409. $delivery_option = json_decode($this->delivery_option, true);
3410. $validated = true;
Argument [0]
3473. {
3474. if (isset(Context::getContext()->cookie->id_country)) {
3475. $default_country = new Country((int) Context::getContext()->cookie->id_country);
3476. }
3477. if (null === $delivery_option) {
3478. $delivery_option = $this->getDeliveryOption($default_country, false, false);
3479. }
3480.
3481. $_total_shipping = [
3482. 'with_tax' => 0,
3483. 'without_tax' => 0,
Argument [0] Argument [1] Argument [2]
91. $computePrecision,
92. $id_carrier = null
93. ) {
94. if ($id_carrier === null) {
95. $this->shippingFees = new AmountImmutable(
96. $cart->getTotalShippingCost(null, true),
97. $cart->getTotalShippingCost(null, false)
98. );
99. } else {
100. $products = $cartRowCollection->getProducts();
101. $this->shippingFees = new AmountImmutable(
Argument [0] Argument [1] 1
349. *
350. * @param int|null $computePrecision Not used since 1.7.7.0, kept for backward compatibility
351. */
352. public function calculateFees($computePrecision = null)
353. {
354. $this->fees->processCalculation($this->cart, $this->cartRows, $this->computePrecision, $this->id_carrier);
355. }
356.
357. /**
358. * @return CartRuleCollection
359. */
Argument [0]
Cart Object
(
[id] =>
[id_shop_group] =>
[id_shop] =>
[id_address_delivery] =>
[id_address_invoice] =>
[id_currency] =>
[id_customer] =>
[id_guest] =>
[id_lang] =>
[recyclable] =>
[gift] =>
[gift_message] =>
[mobile_theme] =>
[date_add] =>
[secure_key] =>
[id_carrier] => 0
[date_upd] =>
[checkedTos] =>
[pictures] =>
[textFields] =>
[delivery_option] =>
[allow_seperated_package] =>
[_products:protected] =>
[_taxCalculationMethod:protected] => 0
[webserviceParameters:protected] => Array
(
[fields] => Array
(
[id_address_delivery] => Array
(
[xlink_resource] => addresses
)
[id_address_invoice] => Array
(
[xlink_resource] => addresses
)
[id_currency] => Array
(
[xlink_resource] => currencies
)
[id_customer] => Array
(
[xlink_resource] => customers
)
[id_guest] => Array
(
[xlink_resource] => guests
)
[id_lang] => Array
(
[xlink_resource] => languages
)
)
[associations] => Array
(
[cart_rows] => Array
(
[resource] => cart_row
[virtual_entity] => 1
[fields] => Array
(
[id_product] => Array
(
[required] => 1
[xlink_resource] => products
)
[id_product_attribute] => Array
(
[required] => 1
[xlink_resource] => combinations
)
[id_address_delivery] => Array
(
[required] => 1
[xlink_resource] => addresses
)
[id_customization] => Array
(
[required] =>
[xlink_resource] => customizations
)
[quantity] => Array
(
[required] => 1
)
)
)
)
)
[configuration:protected] => PrestaShop\PrestaShop\Adapter\Configuration Object
(
[shop:PrestaShop\PrestaShop\Adapter\Configuration:private] =>
[parameters:protected] =>
)
[addressFactory:protected] => PrestaShop\PrestaShop\Adapter\AddressFactory Object
(
)
[shouldSplitGiftProductsQuantity:protected] =>
[shouldExcludeGiftsDiscount:protected] =>
[lang_associated:protected] =>
[id_shop_list] => Array
(
)
[get_shop_from_context:protected] => 1
[table:protected] => cart
[identifier:protected] => id_cart
[fieldsRequired:protected] => Array
(
[0] => id_currency
[1] => id_lang
)
[fieldsSize:protected] => Array
(
[secure_key] => 32
)
[fieldsValidate:protected] => Array
(
[id_shop_group] => isUnsignedId
[id_shop] => isUnsignedId
[id_address_delivery] => isUnsignedId
[id_address_invoice] => isUnsignedId
[id_carrier] => isUnsignedId
[id_currency] => isUnsignedId
[id_customer] => isUnsignedId
[id_guest] => isUnsignedId
[id_lang] => isUnsignedId
[recyclable] => isBool
[gift] => isBool
[gift_message] => isMessage
[mobile_theme] => isBool
[allow_seperated_package] => isBool
[date_add] => isDate
[date_upd] => isDate
)
[fieldsRequiredLang:protected] => Array
(
)
[fieldsSizeLang:protected] => Array
(
)
[fieldsValidateLang:protected] => Array
(
)
[tables:protected] => Array
(
)
[image_dir:protected] =>
[image_format:protected] => jpg
[translator:protected] =>
[def:protected] => Array
(
[table] => cart
[primary] => id_cart
[fields] => Array
(
[id_shop_group] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_shop] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_address_delivery] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_address_invoice] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_carrier] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_currency] => Array
(
[type] => 1
[validate] => isUnsignedId
[required] => 1
)
[id_customer] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_guest] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_lang] => Array
(
[type] => 1
[validate] => isUnsignedId
[required] => 1
)
[recyclable] => Array
(
[type] => 2
[validate] => isBool
)
[gift] => Array
(
[type] => 2
[validate] => isBool
)
[gift_message] => Array
(
[type] => 3
[validate] => isMessage
)
[mobile_theme] => Array
(
[type] => 2
[validate] => isBool
)
[delivery_option] => Array
(
[type] => 3
)
[secure_key] => Array
(
[type] => 3
[size] => 32
)
[allow_seperated_package] => Array
(
[type] => 2
[validate] => isBool
)
[date_add] => Array
(
[type] => 5
[validate] => isDate
)
[date_upd] => Array
(
[type] => 5
[validate] => isDate
)
)
[classname] => Cart
)
[update_fields:protected] =>
[force_id] =>
)
Argument [1]
PrestaShop\PrestaShop\Core\Cart\CartRowCollection Object
(
[cartRows:protected] => Array
(
)
[iteratorPosition:protected] => 0
)
Argument [2]
2
Argument [3]
150. public function processCalculation($computePrecision = null)
151. {
152. // calculate product rows
153. $this->calculateRows();
154. // calculate fees
155. $this->calculateFees();
156. // calculate discounts
157. $this->calculateCartRules();
158. // store state
159. $this->isProcessed = true;
160.
2168. $calculator->calculateFees();
2169. $amount = $calculator->getFees()->getInitialWrappingFees();
2170.
2171. break;
2172. case Cart::BOTH:
2173. $calculator->processCalculation();
2174. $amount = $calculator->getTotal();
2175.
2176. break;
2177. case Cart::BOTH_WITHOUT_SHIPPING:
2178. $calculator->calculateRows();
328. $products = array_map([$this, 'presentProduct'], $rawProducts);
329. $products = $this->addCustomizedData($products, $cart);
330. $subtotals = [];
331.
332. $productsTotalExcludingTax = $cart->getOrderTotal(false, Cart::ONLY_PRODUCTS);
333. $total_excluding_tax = $cart->getOrderTotal(false);
334. $total_including_tax = $cart->getOrderTotal(true);
335. $total_discount = $cart->getDiscountSubtotalWithoutGifts($this->includeTaxes());
336. $totalCartAmount = $cart->getOrderTotal($this->includeTaxes(), Cart::ONLY_PRODUCTS);
337.
338. $subtotals['products'] = [
Argument [0]
496. } else {
497. $cart = new Cart();
498. }
499.
500. $templateVars = [
501. 'cart' => $this->cart_presenter->present($cart),
502. 'currency' => $this->getTemplateVarCurrency(),
503. 'customer' => $this->getTemplateVarCustomer(),
504. 'country' => $this->objectPresenter->present($this->context->country),
505. 'language' => $this->objectPresenter->present($this->context->language),
506. 'page' => $this->getTemplateVarPage(),
Argument [0]
Cart Object
(
[id] =>
[id_shop_group] =>
[id_shop] =>
[id_address_delivery] =>
[id_address_invoice] =>
[id_currency] =>
[id_customer] =>
[id_guest] =>
[id_lang] =>
[recyclable] =>
[gift] =>
[gift_message] =>
[mobile_theme] =>
[date_add] =>
[secure_key] =>
[id_carrier] => 0
[date_upd] =>
[checkedTos] =>
[pictures] =>
[textFields] =>
[delivery_option] =>
[allow_seperated_package] =>
[_products:protected] =>
[_taxCalculationMethod:protected] => 0
[webserviceParameters:protected] => Array
(
[fields] => Array
(
[id_address_delivery] => Array
(
[xlink_resource] => addresses
)
[id_address_invoice] => Array
(
[xlink_resource] => addresses
)
[id_currency] => Array
(
[xlink_resource] => currencies
)
[id_customer] => Array
(
[xlink_resource] => customers
)
[id_guest] => Array
(
[xlink_resource] => guests
)
[id_lang] => Array
(
[xlink_resource] => languages
)
)
[associations] => Array
(
[cart_rows] => Array
(
[resource] => cart_row
[virtual_entity] => 1
[fields] => Array
(
[id_product] => Array
(
[required] => 1
[xlink_resource] => products
)
[id_product_attribute] => Array
(
[required] => 1
[xlink_resource] => combinations
)
[id_address_delivery] => Array
(
[required] => 1
[xlink_resource] => addresses
)
[id_customization] => Array
(
[required] =>
[xlink_resource] => customizations
)
[quantity] => Array
(
[required] => 1
)
)
)
)
)
[configuration:protected] => PrestaShop\PrestaShop\Adapter\Configuration Object
(
[shop:PrestaShop\PrestaShop\Adapter\Configuration:private] =>
[parameters:protected] =>
)
[addressFactory:protected] => PrestaShop\PrestaShop\Adapter\AddressFactory Object
(
)
[shouldSplitGiftProductsQuantity:protected] =>
[shouldExcludeGiftsDiscount:protected] =>
[lang_associated:protected] =>
[id_shop_list] => Array
(
)
[get_shop_from_context:protected] => 1
[table:protected] => cart
[identifier:protected] => id_cart
[fieldsRequired:protected] => Array
(
[0] => id_currency
[1] => id_lang
)
[fieldsSize:protected] => Array
(
[secure_key] => 32
)
[fieldsValidate:protected] => Array
(
[id_shop_group] => isUnsignedId
[id_shop] => isUnsignedId
[id_address_delivery] => isUnsignedId
[id_address_invoice] => isUnsignedId
[id_carrier] => isUnsignedId
[id_currency] => isUnsignedId
[id_customer] => isUnsignedId
[id_guest] => isUnsignedId
[id_lang] => isUnsignedId
[recyclable] => isBool
[gift] => isBool
[gift_message] => isMessage
[mobile_theme] => isBool
[allow_seperated_package] => isBool
[date_add] => isDate
[date_upd] => isDate
)
[fieldsRequiredLang:protected] => Array
(
)
[fieldsSizeLang:protected] => Array
(
)
[fieldsValidateLang:protected] => Array
(
)
[tables:protected] => Array
(
)
[image_dir:protected] =>
[image_format:protected] => jpg
[translator:protected] =>
[def:protected] => Array
(
[table] => cart
[primary] => id_cart
[fields] => Array
(
[id_shop_group] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_shop] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_address_delivery] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_address_invoice] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_carrier] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_currency] => Array
(
[type] => 1
[validate] => isUnsignedId
[required] => 1
)
[id_customer] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_guest] => Array
(
[type] => 1
[validate] => isUnsignedId
)
[id_lang] => Array
(
[type] => 1
[validate] => isUnsignedId
[required] => 1
)
[recyclable] => Array
(
[type] => 2
[validate] => isBool
)
[gift] => Array
(
[type] => 2
[validate] => isBool
)
[gift_message] => Array
(
[type] => 3
[validate] => isMessage
)
[mobile_theme] => Array
(
[type] => 2
[validate] => isBool
)
[delivery_option] => Array
(
[type] => 3
)
[secure_key] => Array
(
[type] => 3
[size] => 32
)
[allow_seperated_package] => Array
(
[type] => 2
[validate] => isBool
)
[date_add] => Array
(
[type] => 5
[validate] => isDate
)
[date_upd] => Array
(
[type] => 5
[validate] => isDate
)
)
[classname] => Cart
)
[update_fields:protected] =>
[force_id] =>
)
564. /**
565. * Initializes common front page content: header, footer and side columns.
566. */
567. public function initContent()
568. {
569. $this->assignGeneralPurposeVariables();
570. $this->process();
571.
572. if (!isset($this->context->cart)) {
573. $this->context->cart = new Cart();
574. }
121. /**
122. * {@inheritdoc}
123. */
124. public function initContent()
125. {
126. parent::initContent();
127.
128. if (
129. Validate::isLoadedObject($this->category)
130. && $this->category->active
131. && $this->category->checkAccess($this->context->customer->id)
314. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
315. $this->initHeader();
316. }
317.
318. if ($this->viewAccess()) {
319. $this->initContent();
320. } else {
321. $this->errors[] = $this->trans('Access denied.', [], 'Admin.Notifications.Error');
322. }
323.
324. if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
505.
506. // Execute hook dispatcher
507. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
508.
509. // Running controller
510. $controller->run();
511.
512. // Execute hook dispatcher after
513. Hook::exec('actionDispatcherAfter', $params_hook_action_dispatcher);
514. } catch (PrestaShopException $e) {
515. $e->displayMessage();
23. * @copyright Since 2007 PrestaShop SA and Contributors
24. * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
25. */
26.
27. require dirname(__FILE__).'/config/config.inc.php';
28. Dispatcher::getInstance()->dispatch();