Jump to content

PrestaShop 1.6 Query Db: Async


Agustin

Recommended Posts

Buenos días,

estoy haciendo varias Querys a la vez con prestashop 1.6 pero aveces 1 quiere se adelanta a otra y surge el error, necesito que 1 query espere ha que haya acabado la anterior para que se ejecute, hacerlas Asíncronas, esto se puede hacer ?

Un saludo dejo un extracto del código de las querys.

// Get Address
$idAddress = $params['order']->id_address_delivery;
$sqlGetAddress = "SELECT * FROM "._DB_PREFIX_."address WHERE id_address = $idAddress";
$dataAddress = Db::getInstance()->ExecuteS($sqlGetAddress);

// Get Country Code
$idCountry = $dataAddress[0]['id_country'];
$sqlGetCountry = "SELECT * FROM "._DB_PREFIX_."country WHERE id_country = $idCountry";
$dataCountry = Db::getInstance()->ExecuteS($sqlGetCountry);

// Get Envio
$modulePayment = $params['order']->module;
$cashOfDelivery = 0;

// Get Message
$idOrder = $params['order']->id;
$sqlGetMessage = "SELECT * FROM "._DB_PREFIX_."message WHERE id_order = $idOrder";
$dataMessage = Db::getInstance()->ExecuteS($sqlGetMessage);
$orderMessage = "...";
if($dataMessage[0]['message']) {
	$orderMessage = $dataMessage[0]['message'];
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...