protected function loadProduct() { $product_id = $this->param('id'); $product = shopProduct::find($product_id); if (!$product) { return $this->controller->run('404'); } return $product; }
use Firestarter\Shop\Models\Currency; use Firestarter\Shop\Models\Settings; Route::group(['prefix' => 'license'], function () { Route::get('order/webmoney/wmz', function () { /** Нужны все валюты */ $currencies = Currency::get()->keyBy('id')->toArray(); /** Это предварительный запрос? */ if (post('LMI_PREREQUEST') == 1) { /** Есть ли такой товар в базе? */ if (!($product = Product::find(post('SHOP_USER_PRODUCT_ID'))->toArray())) { } die("ERROR: НЕТ ТАКОГО ТОВАРА"); /** Строка с пользователем? */ if (!post('SHOP_USER_NAME') or post('SHOP_USER_NAME') == '') { die("ERROR: НЕ УКАЗАН ПОЛЬЗОВАТЕЛЬ"); } /** Строка с почтой? */ if (!post('SHOP_USER_EMAIL') or post('SHOP_USER_EMAIL') == '') { die("ERROR: НЕ УКАЗАН EMAIL"); } /**
public function getProductIdOptions() { return Product::lists('name', 'id'); }
public function onRun() { $this->currencies = $this->page['currencies'] = Currency::get()->toArray(); $this->products = $this->page['products'] = Product::get()->toArray(); }