49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?
|
|
include('config/config.inc.php');
|
|
include('app/config/parameters.php');
|
|
include('config/defines.inc.php');
|
|
include( 'init.php' );
|
|
|
|
$context = Context::getContext();
|
|
|
|
if ( $_GET['action'] == 'getCartProductsCount' )
|
|
{
|
|
$productsInCart = $context->cart->getProducts();
|
|
foreach ( $productsInCart as $product )
|
|
{
|
|
$totalProductsInCart += $product['cart_quantity'];
|
|
}
|
|
echo json_encode( [ 'product_count' => $totalProductsInCart, 'result' => 'success' ] );
|
|
exit;
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
include 'medoo.php';
|
|
|
|
$database = [
|
|
'database_host' => 'mariadb1011.server493388.nazwa.pl',
|
|
'database_port' => '',
|
|
'database_name' => 'server493388_wyczarujprezent-prod',
|
|
'database_user' => 'server493388_wyczarujprezent-prod',
|
|
'database_password' => 'rtBFCfuQ6dzrWy9eY49A'
|
|
];
|
|
|
|
$mdb = new medoo( [
|
|
'database_type' => 'mysql',
|
|
'database_name' => $database[ 'database_name' ],
|
|
'server' => $database[ 'database_host' ],
|
|
'username' => $database[ 'database_user' ],
|
|
'password' => $database[ 'database_password' ],
|
|
'charset' => 'utf8'
|
|
] );
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if (isset($_POST['customizationId'])) {
|
|
$customizationId = $_POST['customizationId'];
|
|
$newValue = $_POST['newValue'];
|
|
$mdb->update('pr_customized_data', ['value' => $newValue], ['id_customization' => $customizationId]);
|
|
echo 'saved';
|
|
}
|
|
}
|
|
?>
|