public function revalInfoAction() { $this->view->disable(); if ($this->request->isAjax()) { $product_id = $this->request->get('product_id'); $product = PProductMain::findFirst($product_id); $product_title = isset($product->getsingleInfo("lang='ru'")->title) ? $product->getsingleInfo("lang='ru'")->title : $product->title; // $curr_rate = PCrosscurrency::findFirst("title='{$product->maker->currencystr}'")->currencyrate; // $maker_price_usd = round($product->oneProductPrice / $curr_rate, 2); // Price change history $history_list = []; if ($history = PTasks::find(["trole='priceMaker' AND tprodid={$product_id}", 'order' => 'tstart DESC'])) { foreach ($history as $hist) { $prices = preg_split('/[\\s]/', $hist->tinfo); $history_list[] = ['history_name' => $hist->Accounts->name, 'history_date' => date('d.m.Y H:i', $hist->tstart), 'history_maker_price' => $prices[0], 'history_maker_price_usd' => $prices[1], 'history_export_price' => $prices[2]]; } } $info = ['product_id' => $product->id, 'product_title' => $product_title, 'maker_name' => $product->maker->name, 'price_maker' => $product->oneProductPrice, 'maker_curr' => $product->maker->currencystr, 'maker_price_usd' => $product->holdpriceusd, 'price_usd' => $product->priceUSD, 'history' => $history_list]; echo json_encode($info); } }