/** * main action */ public function mainAction() { require_once 'models/ecommerce/ecommerce_product.php'; require_once 'models/ecommerce/ecommerce_product_variety.php'; require_once 'models/ecommerce/ecommerce_price.php'; $Product = new ecommerce_product(); $Product_variety = new ecommerce_product_variety(); $Price = new ecommerce_price(); $this->tpl->assign("VARIETY_CONF", $Product_variety->conf); if ($_POST['save']) { $product_data = $_POST['product']; /** * add product */ if ($product_id = $Product->insertFullProduct($product_data)) { msg("Product id={$product_id} interted."); //TODO: implement two options: 1. save end this, 2. save and add another onxshopGoTo("backoffice/products/{$product_id}/edit"); //empty $product_data = array(); } else { msg("Product add has failed.", 'error'); } } else { $product_data = array(); $product_data['variety'] = array(); $product_data['variety']['price'] = array(); $product_data['variety']['name'] = 'Item'; $product_data['variety']['weight_gross'] = 0; $product_data['variety']['stock'] = 999; $product_data['variety']['price']['value'] = 0; } $this->tpl->assign('PRODUCT', $product_data); return true; }
/** * main action */ public function mainAction() { /** * initialize */ require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); /** * save */ if ($_POST['save']) { $product_data = $_POST['product']; if ($id = $Product->updateProduct($product_data)) { /** * forward to product list main page and exit */ onxshopGoTo("/backoffice/products"); return true; } } /** * product detail */ $product = $Product->detail($this->GET['id']); $product['publish'] = $product['publish'] == 1 ? 'checked="checked" ' : ''; $this->tpl->assign('PRODUCT', $product); return true; }
/** * main action */ public function mainAction() { /** * check input */ if ($_SESSION['client']['customer']['id'] == 0 && !Onxshop_Bo_Authentication::getInstance()->isAuthenticated()) { msg('controllers/client/customer_detail: You must logged in.', 'error'); onxshopGoTo("/"); } else { if (is_numeric($this->GET['customer_id']) && constant('ONXSHOP_IN_BACKOFFICE')) { $customer_id = $this->GET['customer_id']; } else { $customer_id = $_SESSION['client']['customer']['id']; } } if (!is_numeric($customer_id)) { return false; } /** * initialize */ require_once 'models/client/client_customer.php'; $Customer = new client_customer(); $Customer->setCacheable(false); /** * get customer detail */ $customer_detail = $Customer->getDetail($customer_id); if (is_array($customer_detail)) { $this->tpl->assign('ITEM', $customer_detail); } else { msg('controllers/client/customer_detail: cannot get detail', 'error'); } return true; }
/** * main action */ public function mainAction() { $this->Offer_Group = new ecommerce_offer_group(); $offer_group_id = (int) $this->GET['offer_group_id']; if ($_POST['save']) { $_POST['offer_group']['schedule_start'] = $this->dateAndTimeToFull($_POST['offer_group']['start_date'], $_POST['offer_group']['start_time']); $_POST['offer_group']['schedule_end'] = $this->dateAndTimeToFull($_POST['offer_group']['end_date'], $_POST['offer_group']['end_time']); $offer_group_id = $this->processForm($_POST['offer_group'], $offer_group_id); onxshopGoTo("/backoffice/products"); } else { $_POST['offer_group']['schedule_start'] = date("Y-m-d", time() + 7 * 24 * 3600); $_POST['offer_group']['schedule_end'] = date("Y-m-d", time() + 14 * 24 * 3600); $_POST['offer_group']['publish'] = 1; } if ($offer_group_id > 0) { $offer_group = $this->Offer_Group->detail($offer_group_id); } else { $offer_group = $_POST['offer_group']; } if ($offer_group['publish']) { $offer_group['publish'] = 'checked="checked"'; } else { $offer_group['publish'] = ''; } $this->tpl->assign("OFFER_GROUP", $offer_group); return true; }
/** * send to registration */ function dispatchToRegistration($node_conf) { if ($this->GET['to']) { $_SESSION['to'] = $this->GET['to']; } onxshopGoTo('/page/' . $node_conf['id_map-registration']); }
/** * custom comment action */ public function customCommentAction($data, $options) { if ($this->checkEditPermission($data)) { if (is_numeric($this->GET['comment_id'])) { $comment_id = $this->GET['comment_id']; } else { return false; } if (is_numeric($this->GET['publish'])) { $publish = $this->GET['publish']; } else { return false; } $comment_data = $this->Comment->getDetail($comment_id); $comment_data['publish'] = $publish; if ($this->Comment->updateComment($comment_data)) { if ($publish == 1) { msg("Recipe review ID {$comment_id} approved by client ID {$_SESSION['client']['customer']['id']}"); } else { if ($publish == -1) { msg("Recipe review ID {$comment_id} rejected by client ID {$_SESSION['client']['customer']['id']}"); } } onxshopGoTo($_SESSION['referer'], 2); } } return true; }
/** * main action */ public function mainAction() { $this->initModels(); /** * Store submited data to the SESSION */ if (isset($_POST['comments-filter'])) { $_SESSION['bo'][$this->key]['comments-filter'] = $_POST['comments-filter']; onxshopGoTo($this->GET["translate"]); } /** * Initialize pagination variables */ if (is_numeric($this->GET['limit_from'])) { $from = $this->GET['limit_from']; } else { $from = 0; } if (is_numeric($this->GET['limit_per_page'])) { $per_page = $this->GET['limit_per_page']; } else { $per_page = 25; } $limit = "{$from},{$per_page}"; /** * Prepare filter */ $filter = array(); $s = $_SESSION['bo'][$this->key]['comments-filter']; if ($s['location'] > 0) { $filter['node_id'] = $s['location']; } if (!empty($s['query'])) { $filter['query'] = $s['query']; } $this->tpl->assign("QUERY", $s['query']); /** * Load List */ $list = $this->Comment->getCommentList($filter, 'id DESC', $limit); $count = $this->Comment->getCommentCount($filter); /** * Display pagination */ $_Onxshop_Request = new Onxshop_Request("component/pagination~limit_from={$from}:limit_per_page={$per_page}:count={$count}~"); $this->tpl->assign('PAGINATION', $_Onxshop_Request->getContent()); /** * Display comments */ $this->parseList($list); /** * Get used node ids and corresponding names */ $nodes = $this->Comment->getUsedNodes(); /** * Display location filter dropdown */ $this->parseLocationSelect($nodes); return true; }
/** * main action */ public function mainAction() { if ($_SESSION['client']['customer']['id'] > 0) { require_once 'models/client/client_customer.php'; $ClientCustomer = new client_customer(); if ($ClientCustomer->logout()) { msg("Logout of {$_SESSION['client']['customer']['email']}", 'ok', 1); //$_SESSION['client']['customer']['id'] = 0; unset($_SESSION['client']); // unlink basket from customer unset($_SESSION['basket']); // clear gift parameters unset($_SESSION['gift']); unset($_SESSION['gift_message']); $this->invalidateToken(); //clean facebook auth $this->logoutFromFacebook(); } else { msg("Customer logout failed", 'error'); } } //forward to the homepage onxshopGoTo(AFTER_CLIENT_LOGOUT_URL); return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if (!is_array($node_data['component'])) { $node_data['component'] = array(); $node_data['component']['node_controller'] = 'common_simple'; } if ($node_data['component']['sending_failed'] == '') { $node_data['component']['sending_failed'] = 'The provided data is not valid! Required items are marked with an asterisk (*)'; } if ($node_data['component']['text'] == '') { $node_data['component']['text'] = "Thank you for your feedback."; } $this->tpl->assign("NODE", $node_data); $template_folder = "component/contact_form/"; $template_name = "{$template_folder}{$node_data['component']['node_controller']}"; /** * check template file exists */ if (!templateExists($template_name)) { // try fallback to old _contact_form folder in case it was locally created (used prior to Onxshop 1.7.6) $template_folder = "component/_contact_form/"; $template_name = "{$template_folder}{$node_data['component']['node_controller']}"; if (!templateExists($template_name)) { msg("selected template {$template_name} was not found"); return false; } } /** * execute controller */ $Form = new Onxshop_Request("component/contact_form@{$template_name}&node_id={$node_data['id']}&mail_to={$node_data['component']['mail_to']}&mail_toname={$node_data['component']['mail_toname']}&spam_protection={$node_data['component']['spam_protection']}"); $this->tpl->assign("FORM", $Form->getContent()); $reg_key = "form_notify_" . $node_data['id']; if (Zend_Registry::isRegistered($reg_key)) { if (Zend_Registry::get($reg_key) == 'sent') { //forward msg($node_data['component']['text'], 'ok'); if ($node_data['component']['href'] != '') { onxshopGoTo($node_data['component']['href']); } } else { if (Zend_Registry::get($reg_key) == 'failed') { msg($node_data['component']['sending_failed'], 'error'); $this->tpl->parse('content.form'); } else { $this->tpl->parse('content.form'); } } } else { $this->tpl->parse('content.form'); } if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * main action */ public function mainAction() { if ($_SESSION['client']['customer']['id'] == 0 && !Onxshop_Bo_Authentication::getInstance()->isAuthenticated()) { msg('client_edit: You must be logged in first.', 'error'); onxshopGoTo("/"); } require_once 'models/client/client_customer.php'; $Customer = new client_customer(); $Customer->setCacheable(false); $customer_id = $_SESSION['client']['customer']['id']; if (!is_numeric($customer_id)) { return false; } if ($_POST['save']) { $_POST['client']['customer']['id'] = $customer_id; // do not allow to set certain properties unset($_POST['client']['customer']['status']); unset($_POST['client']['customer']['group_id']); unset($_POST['client']['customer']['group_ids']); unset($_POST['client']['customer']['role_ids']); unset($_POST['client']['customer']['account_type']); unset($_POST['client']['customer']['other_data']); /** * check birthday field format */ if ($_POST['client']['customer']['birthday']) { // check, expected as dd/mm/yyyy if (!preg_match('/^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$/', $_POST['client']['customer']['birthday'])) { msg('Invalid format for birthday, use dd/mm/yyyy', 'error'); return false; } // Format to ISO $_POST['client']['customer']['birthday'] = strftime('%Y-%m-%d', strtotime(str_replace('/', '-', $_POST['client']['customer']['birthday']))); } /** * update */ if ($Customer->updateClient($_POST['client'])) { msg(I18N_CUSTOMER_DATA_UPDATED); } else { msg("Can't update client data", 'error'); } } $client_data = $Customer->getClientData($customer_id); $client_data['customer']['newsletter'] = $client_data['customer']['newsletter'] == 1 ? 'checked="checked" ' : ''; // format birthday only if available to avoid 01/01/1970 by default if ($client_data['customer']['birthday'] != '') { $client_data['customer']['birthday'] = strftime('%d/%m/%Y', strtotime($client_data['customer']['birthday'])); } $this->tpl->assign('CLIENT', $client_data); /** * show password field only if previously set */ if ($client_data['customer']['password']) { $this->tpl->parse('content.password'); } return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $node_conf = common_node::initConfiguration(); if ($_SESSION['client']['customer']['id'] > 0) { onxshopGoTo("page/{$node_conf['id_map-checkout_delivery_options']}"); } else { onxshopGoTo("page/{$node_conf['id_map-checkout_login']}"); } return true; }
/** * main action */ public function mainAction() { // initialize require_once 'models/ecommerce/ecommerce_store.php'; $Store = new ecommerce_store(); // save if ($_POST['save']) { // set values if (!isset($_POST['store']['publish'])) { $_POST['store']['publish'] = 0; } $_POST['store']['modified'] = date('c'); // handle other_data $_POST['store']['other_data'] = serialize($_POST['store']['other_data']); // force numeric types $_POST['store']['coordinates_x'] = (int) $_POST['store']['coordinates_x']; $_POST['store']['coordinates_y'] = (int) $_POST['store']['coordinates_y']; $_POST['store']['latitude'] = (double) $_POST['store']['latitude']; $_POST['store']['longitude'] = (double) $_POST['store']['longitude']; // serialize street_view_options $_POST['store']['street_view_options'] = serialize($_POST['store']['street_view_options']); // remove if country_id isn't numeric if (!is_numeric($_POST['store']['country_id'])) { unset($_POST['store']['country_id']); } // update store if ($id = $Store->update($_POST['store'])) { msg("Store ID={$id} updated"); // update node info (if exists) $store_homepage = $Store->getStoreHomepage($_POST['store']['id']); if (is_array($store_homepage) && count($store_homepage) > 0) { $store_homepage['publish'] = $_POST['store']['publish']; require_once 'models/common/common_node.php'; $Node = new common_node(); $Node->nodeUpdate($store_homepage); } // forward to store list main page and exit onxshopGoTo("/backoffice/stores"); return true; } else { msg("Cannot update store details", 'error'); } } // store detail $store = $Store->detail($this->GET['id']); $store['publish'] = $store['publish'] == 1 ? 'checked="checked" ' : ''; $store['street_view_options'] = unserialize($store['street_view_options']); $this->tpl->assign('STORE', $store); $this->tpl->assign('STREET_VIEW_IMAGE_' . (int) $store['street_view_options']['image'], 'checked="checked"'); $this->parseTypeSelect($store['type_id']); return true; }
/** * main action */ public function mainAction() { if ($_SESSION['client']['customer']['id'] == 0) { msg('payment_callback_protx: You must be logged in.'); onxshopGoTo("/"); } require_once 'conf/payment/protx.php'; $this->transactionPrepare(); if (is_numeric($this->GET['order_id']) && $this->GET['crypt'] != '') { $this->paymentProcess($this->GET['order_id'], $this->GET['crypt']); } return true; }
/** * main action */ public function mainAction() { if ($customer_data = $_POST['client']['customer']) { require_once 'models/client/client_customer.php'; $Customer = new client_customer(); if ($id = $Customer->registerCustomer($customer_data)) { onxshop_flush_cache(); onxshopGoTo("/backoffice/customers/{$id}/detail"); } else { msg("Cannot add user", 'error'); } } return true; }
/** * main action */ public function mainAction() { /** * include node configuration */ require_once 'models/common/common_node.php'; $Node = new common_node(); /** * nothing to do here, forward first parent page */ $first_parent_page_id = $Node->getParentPageId($this->GET['id']); onxshopGoTo("page/" . $first_parent_page_id); return true; }
/** * main action */ public function mainAction() { require_once 'models/ecommerce/ecommerce_product.php'; $Product = new ecommerce_product(); $product_data = $_POST['product']; if ($_POST['save']) { if ($id = $Product->insertProduct($product_data)) { msg("Product has been added."); onxshopGoTo("backoffice/products/{$id}/variety_add"); } else { msg("Adding of Product Failed.", 'error'); } } $this->tpl->assign('PRODUCT', $product_data); return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); $this->tpl->assign("NODE", $node_data); if ($node_data['component']['href'] != '') { header("HTTP/1.1 301 Moved Permanently"); if (preg_match('/\\:\\/\\//', $node_data['component']['href'])) { onxshopGoTo($node_data['component']['href'], 2); } else { onxshopGoTo($node_data['component']['href']); } } return true; }
/** * main action */ public function mainAction() { if ($this->GET['to']) { header("HTTP/1.1 301 Moved Permanently"); onxshopGoTo($this->GET['to']); } else { if (is_numeric($this->GET['product_id'])) { header("HTTP/1.1 301 Moved Permanently"); require_once 'models/common/common_node.php'; $Node = new common_node(); $product_homepage = $Node->getProductNodeHomepage($this->GET['product_id']); if (is_array($product_homepage)) { onxshopGoTo("/page/{$product_homepage['id']}"); } else { msg("Product no longer available"); onxshopGoTo("/"); } } else { if (is_numeric($this->GET['recipe_id'])) { header("HTTP/1.1 301 Moved Permanently"); require_once 'models/common/common_node.php'; $Node = new common_node(); $recipe_homepage = $Node->getRecipeNodeHomepage($this->GET['recipe_id']); if (is_array($recipe_homepage)) { onxshopGoTo("/page/{$recipe_homepage['id']}"); } else { msg("Recipe no longer available"); onxshopGoTo("/"); } } else { if (is_numeric($this->GET['store_id'])) { header("HTTP/1.1 301 Moved Permanently"); require_once 'models/ecommerce/ecommerce_store.php'; $Store = new ecommerce_store(); $store_homepage = $Store->getStoreHomepage($this->GET['store_id']); if (is_array($store_homepage)) { onxshopGoTo("/page/{$store_homepage['id']}"); } else { msg("Store no longer available"); onxshopGoTo("/"); } } } } } return true; }
/** * main action */ public function mainAction() { $this->init(); if (!$this->securityCheck($this->customer_id)) { return false; } $this->tpl->parse("content.promotion_generator"); // generate vouchers if user clicked the button if ($this->GET['generate'] === 'true') { $customer_name = $this->getActiveCustomerName(); $title = $customer_name . "'s invitation"; $this->createCodeByCustomer($this->customer_id, $title, $this->conf['discount_value']); // redirect to itself onxshopGoTo($this->GET["translate"]); } return true; }
public function processUnsubscription($id, $key, $customer_id) { if ($id > 0 && strlen($key) == 32) { $detail = $this->Watchdog->detail($id); if ($detail['id'] == $id && $key == $this->Watchdog->generateKey($id)) { $this->Watchdog->setPublish($id, 0); $product = $this->getProductInfo($detail['watched_item_id']); msg("{$product['name']} - {$product['variety']['name']} has been removed from your watch list. We will no longer notify you regarding this product."); if ($customer_id == $detail['customer_id']) { onxshopGoTo("page/" . $this->node_conf['id_map-notifications']); } else { onxshopGoTo($product['url']); } } } msg("Invalid customer id or security key provided.", "error"); return false; }
/** * main action */ public function mainAction() { if ($_SESSION['client']['customer']['id'] > 0) { $customer_id = $_SESSION['client']['customer']['id']; } else { if (Onxshop_Bo_Authentication::getInstance()->isAuthenticated()) { $customer_id = $this->GET['customer_id']; } else { msg('orders: You must be logged in first.', 'error'); onxshopGoTo("/"); } } /** * include node configuration */ require_once 'models/common/common_node.php'; $node_conf = common_node::initConfiguration(); $this->tpl->assign('NODE_CONF', $node_conf); /** * Get the list */ require_once 'models/ecommerce/ecommerce_order.php'; $Order = new ecommerce_order(); $Order->setCacheable(false); $records = $Order->getOrderList($customer_id); /** * parse output */ if (count($records) > 0) { foreach ($records as $item) { $item['order_created'] = strftime('%d/%m/%Y %H:%M', strtotime($item['order_created'])); $item['status_title'] = $Order->getStatusTitle($item['order_status']); $this->tpl->assign('ITEM', $item); if ($Order->checkOrderStatusValidForPayment($item['order_status'])) { $this->tpl->parse('content.orders.item.make_payment'); } $this->tpl->parse('content.orders.item'); } $this->tpl->parse('content.orders'); } else { $this->tpl->parse('content.noorders'); } return true; }
/** * main action */ public function mainAction() { $Recipe = new ecommerce_recipe(); $recipe_data = $_POST['recipe']; $page_node_id = $recipe_data['page_node_id']; unset($recipe_data['page_node_id']); if ($_POST['save']) { if ($id = $Recipe->insertRecipe($recipe_data)) { $recipe_homepage = $this->insertNewRecipeToNode($id, $page_node_id); msg("Recipe has been added."); onxshopGoTo("backoffice/recipes/{$id}/edit"); } else { msg("Adding of Recipe Failed.", 'error'); } } $recipe_data['page_node_id'] = (int) $_SESSION['active_pages'][0]; $this->tpl->assign('RECIPE', $recipe_data); return true; }
/** * main action */ public function mainAction() { /** * Store submited data to the SESSION */ if (isset($_POST['voucher-filter'])) { $_SESSION['bo']['voucher-filter'] = $_POST['voucher-filter']; onxshopGoTo('/backoffice/marketing'); } else { if (!isset($_SESSION['bo']['voucher-filter']['type'])) { $_SESSION['bo']['voucher-filter']['type'] = 1; } } $filter = $_SESSION['bo']['voucher-filter']; $this->tpl->assign('FILTER', $filter); $this->parseTypeSelect($filter['type']); $this->tpl->parse("content.form"); return true; }
/** * main action */ public function mainAction() { if (in_array($this->GET['scope'], array('database', 'project', 'both'))) { $scope = $this->GET['scope']; } else { $scope = 'both'; } if (ONXSHOP_ALLOW_BACKUP_DOWNLOAD) { set_time_limit(0); if ($filename = $this->createBackup($scope)) { $this->notificationEmail(); onxshopGoTo("/download/var/backup/{$filename}"); } else { msg("Can't create backup", 'error'); } } else { msg('Sorry, this feature is disabled in your installation', 'error'); } }
/** * main action */ public function mainAction() { /** * include node configuration */ require_once 'models/common/common_node.php'; $Node = new common_node(); /** * nothing to do here, forward first parent page */ $first_parent_page_id = $Node->getParentPageId($this->GET['id']); if (is_numeric($first_parent_page_id) && $first_parent_page_id > 0) { onxshopGoTo("page/" . $first_parent_page_id); } else { // there is no parent page to this container, forward to homepage onxshopGoto("page/" . $Node->conf['id_map-homepage']); } return true; }
/** * main action */ public function mainAction() { $Store = new ecommerce_store(); $store_data = $_POST['store']; $page_node_id = $store_data['page_node_id']; unset($store_data['page_node_id']); if ($_POST['save']) { if ($id = $Store->insertStore($store_data)) { $store_homepage = $this->insertNewStoreToNode($id, $page_node_id); msg("Store has been added."); onxshopGoTo("backoffice/stores/{$id}/edit"); } else { msg("Adding of Store Failed.", 'error'); } } $store_data['page_node_id'] = (int) $_SESSION['active_pages'][0]; $this->tpl->assign('STORE', $store_data); return true; }
/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); $node_data = $Node->nodeDetail($this->GET['id']); if (!is_array($node_data['component'])) { $node_data['component'] = array(); $node_data['component']['node_controller'] = 'common_simple'; } if ($node_data['component']['sending_failed'] == '') { $node_data['component']['sending_failed'] = 'The provided data is not valid! Required items are marked with an asterisk (*)'; } if ($node_data['component']['text'] == '') { $node_data['component']['text'] = "Thank you for your feedback."; } $this->tpl->assign("NODE", $node_data); $Form = new Onxshop_Request("component/contact_form@component/_contact_form/{$node_data['component']['node_controller']}&node_id={$node_data['id']}&mail_to={$node_data['component']['mail_to']}&mail_toname={$node_data['component']['mail_toname']}&spam_protection={$node_data['component']['spam_protection']}"); $this->tpl->assign("FORM", $Form->getContent()); $reg_key = "form_notify_" . $node_data['id']; if (Zend_Registry::isRegistered($reg_key)) { if (Zend_Registry::get($reg_key) == 'sent') { //forward msg($node_data['component']['text'], 'ok'); if ($node_data['component']['href'] != '') { onxshopGoTo($node_data['component']['href']); } } else { if (Zend_Registry::get($reg_key) == 'failed') { msg($node_data['component']['sending_failed'], 'error'); $this->tpl->parse('content.form'); } else { $this->tpl->parse('content.form'); } } } else { $this->tpl->parse('content.form'); } if ($node_data['display_title']) { $this->tpl->parse('content.title'); } return true; }
/** * loginToOnxshop */ public function loginToOnxshop($user_profile) { require_once 'models/client/client_customer.php'; $Customer = new client_customer(); $Customer->setCacheable(false); if ($customer_detail = $Customer->getUserByTwitterId($user_profile->id)) { //already exists a valid account, we can login msg("{$customer_detail['email']} is already registered", 'ok', 1); $_SESSION['client']['customer'] = $customer_detail; $_SESSION['use_page_cache'] = false; // auto login (TODO allow to enable/disable this behaviour) $Customer->generateAndSaveOnxshopToken($customer_detail['id']); } else { msg("Twitter ID {$user_profile->id} sucessfully authorised, but must register locally", 'ok', 1); //forward to registration $this->mapUserToOnxshop($user_profile); onxshopGoTo("/page/13"); //TODO get node_id from conf } }
/** * main action */ public function mainAction() { // initialize require_once 'models/ecommerce/ecommerce_recipe.php'; $Recipe = new ecommerce_recipe(); // save if ($_POST['save']) { // update recipe if ($recipe_id = $Recipe->updateRecipe($_POST['recipe'])) { msg("Recipe ID={$recipe_id} updated"); // forward to recipe list main page and exit onxshopGoTo("/backoffice/recipes"); return true; } } // recipe detail $recipe = $Recipe->detail($this->GET['id']); $recipe['publish'] = $recipe['publish'] == 1 ? 'checked="checked" ' : ''; $this->tpl->assign('RECIPE', $recipe); return true; }
/** * Forward to thank you page */ public function displaySuccessPage($href) { onxshopGoTo($href); }