public function execute() { $id = (int) waRequest::get('id'); $html = ''; $app_settings_model = new waAppSettingsModel(); $settings = $app_settings_model->get(array('shop', 'fprview')); $product = new shopProduct($id); $route_params = array('product_url' => $product['url']); if (isset($product['category_url'])) { $route_params['category_url'] = $product['category_url']; } $product['frontend_url'] = wa()->getRouteUrl('shop/frontend/product', $route_params); $feature_codes = array_keys($product->features); $feature_model = new shopFeatureModel(); $features = $feature_model->getByCode($feature_codes); $theme = waRequest::param('theme', 'default'); $theme_path = wa()->getDataPath('themes', true) . '/' . $theme; if (!file_exists($theme_path) || !file_exists($theme_path . '/theme.xml')) { $theme_path = wa()->getAppPath() . '/themes/' . $theme; } switch ($settings['template_type']) { case 'plugin': $view = wa()->getView(); $view->assign('features', $features); $view->assign('product', $product); $view->assign('fprview_settings', $settings); $html = $view->fetch(realpath(dirname(__FILE__) . "/../../") . '/templates/Frontend.html'); break; case 'theme': if ($settings['template_theme_file'] && file_exists($theme_path . '/' . $settings['template_theme_file'])) { $view = wa()->getView(array('template_dir' => $theme_path)); list($services, $skus_services) = $this->getServiceVars($product); $compare = waRequest::cookie('shop_compare', array(), waRequest::TYPE_ARRAY_INT); $stock_model = new shopStockModel(); $view->assign(array('sku_services' => $skus_services, 'services' => $services, 'compare' => in_array($product['id'], $compare) ? $compare : array(), 'currency_info' => $this->getCurrencyInfo(), 'stocks' => $stock_model->getAll('id'), 'reviews' => $this->getTopReviews($product['id']), 'rates' => $this->reviews_model->getProductRates($product['id']), 'reviews_total_count' => $this->getReviewsTotalCount($product['id']), 'features' => $features, 'product' => $product)); $view->assign('frontend_product', wa()->event('frontend_product', $product, array('menu', 'cart', 'block_aux', 'block'))); $template = $this->setThemeTemplate($settings['template_theme_file']); $html = $view->fetch($this->getTemplate()); } break; default: $html = ''; break; } echo $html; exit; }