$smart = 'colors-is-red-or-pink-or-blue-or-tortoise/form-is-elliptical-or-rectangular/material-is-plastic';
$defs = [];
foreach(explode('/', $smart) as $part) {
$def = explode('-is-', $part);
$defs[$def[0]] = explode('-or-', $def[1]);
}
print_r($defs);
[
"colors" => ["red", "pink", "blue", "tortoise"],
"form" => ["elliptical", "rectangular"],
"material" => ["plastic"]
]
$request = '<?xml version="1.0" encoding="UTF-8" ?><DeliveryRequest Number="0000033876WO" Date="2019-04-29T11:22:43" Account="2JewP******NCbIIbKAw2" Secure="4a3ac********bc5f" OrderCount="1"><Order Number="1520" SendCityPostCode="350000" RecCityPostCode="350000" RecipientName="Герусов Александр Валерьевич" RecipientEmail="gerusov14@mail.ru" Phone="89615096005" TariffTypeCode="136" DeliveryRecipientCost="137" DeliveryRecipientVATRate="VATX" DeliveryRecipientVATSum="0" SellerName="ИП Волженин Е.Г." SellerAddress="Ленинградская обл, Всеволожский р-н, Пос. Лесное, дом № 18, кв.6"><Address PvzCode="KSD5"/><Package Number="1" BarCode="krd61927-1" Weight="1000"><Item WareKey="158308" Cost="790" Payment="790" PaymentVATRate="VATX" PaymentVATSum="0" Weight="1000" Amount="1" Comment="Кронштейн для телевизора Ultramounts UM 814F черный"/></Package></Order></DeliveryRequest>';
$host_api = 'https://integration.cdek.ru/new_orders.php';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $host_api);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, ['xml_request' => $request]);
$response = curl_exec($curl);
if ($response === false) {
echo "cURL Error: " . curl_error($curl);
}
$sent_headers = curl_getinfo($curl, CURLINFO_HEADER_OUT);
curl_close($curl);
echo "<pre>";
var_dump($response);
echo "</pre>";
SELECT @Code=t1.КодТовара, @Итог=t1.Количество, @Имя=t2.Наименование
FROM (
SELECT КодТовара, SUM(Количество) AS Количество
FROM Заказ
WHERE ДатаЗаказа BETWEEN GetDate()-@Интервал AND GetDate()
GROUP BY КодТовара
) AS t1
JOIN Товар AS t2
ON t2.КодТовара = t1.КодТовара
ORDER BY t1.Количество * IF(@ТипРезультата = 1, 1, -1)
object yii\db\ActiveQuery [
"sql" => "SELECT * FROM clients WHERE id_cart = 9455958663",
"on" => null,
"joinWith" => null,
"select" => null,
"selectOption" => null,
"distinct" => null,
"from" => null,
"groupBy" => null,
"join" => null,
"having" => null,
"union" => null,
"params" => [],
"queryCacheDuration" => null,
"queryCacheDependency"=> null,
"yii\base\Component_events" => [],
"yii\base\Component_eventWildcards" => [],
"yii\base\Component_behaviors" => [],
"where" => null,
"limit" => null,
"offset" => null,
"orderBy" => null,
"indexBy" => null,
"emulateExecution" => false,
"modelClass" => "frontend\models\Clients",
"with" => null,
"asArray" => null,
"multiple" => null,
...
]