public function index_onSave() { try { $config = new Sitemap_Params(); $config = $config->load(); $config->save(post($this->form_model_class, array()), $this->formGetEditSessionKey()); echo Backend_Html::flash_message('Sitemap configuration has been successfully saved.'); } catch (Exception $ex) { Phpr::$response->ajaxReportException($ex, true, true); } //save pages $page_list = Cms_Page::create()->find_all(); foreach ($page_list as $id => $page) { $visible = 0; if (isset($_POST['pages'][$page->id])) { $visible = 1; } Db_DbHelper::query('update pages set sitemap_visible=:visible where id=:id', array('visible' => $visible, 'id' => $page->id)); } }
public function get_product_url($product_id, $default = null) { if (Cms_Theme::is_theming_enabled() && ($active_theme = Cms_Theme::get_active_theme())) { $page = Db_DbHelper::scalar("select url from pages inner join cms_page_references cpr on (pages.id = cpr.page_id)\n\t\t\t\t\twhere cpr.object_id=:product_id\n\t\t\t\t\tand object_class_name = 'Shop_Product'\n\t\t\t\t\tand reference_name = 'page_id'\n\t\t\t\t\tand page_id in (select id from pages where theme_id = :theme_id)", array('product_id' => $product_id, 'theme_id' => $active_theme->id)); return $page; } else { return $default; } }