/**
  * public action
  */
 public function mainAction()
 {
     parent::mainAction();
     if ($_SESSION['client']['customer']['id'] == 0) {
         $node_conf = common_node::initConfiguration();
         onxshopGoto($node_conf['id_map-checkout_login']);
     }
     if ($_POST['node_id'] == $this->GET['node_id'] && is_numeric($_POST['selected_address_id'])) {
         onxshopGoto("page/{$_SESSION['active_pages'][0]}");
     }
     return true;
 }
示例#2
0
 /**
  * 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;
 }
示例#3
0
 /**
  * main action
  */
 public function mainAction()
 {
     return true;
     $order_id = (int) $this->GET['order_id'];
     if ($order_id == 0) {
         return true;
     }
     $Order = new ecommerce_order();
     $Order->setCacheable(false);
     $order_data = $Order->getFullDetail($order_id);
     if ($order_data['transaction']['id'] > 0) {
         $this->tpl->parse('content.button');
         if ($this->GET['resend_email'] == 'yes') {
             // implement in your installation
             onxshopGoto("/backoffice/orders/{$order_data['id']}/detail");
         }
     }
     return true;
 }
示例#4
0
 /**
  * main action
  */
 public function mainAction()
 {
     $this->Survey = $this->initializeSurvey();
     /**
      * Save on request
      */
     if ($_POST['save'] && is_array($_POST['survey'])) {
         $this->saveSurvey($_POST['survey']);
         $id = (int) $this->GET['id'];
         onxshopGoto("/backoffice/surveys/{$id}/detail");
     }
     /**
      * Display Detail
      */
     if (is_numeric($this->GET['id'])) {
         $this->displaySurvey($this->GET['id']);
     }
     /**
      * destroy
      */
     $this->Survey = false;
     return true;
 }
示例#5
0
 /**
  * edit address
  */
 public function editAddress()
 {
     $_POST['client']['address']['customer_id'] = $_SESSION['client']['customer']['id'];
     if ($address_id = $this->isDuplicateAddress($_POST['client']['address'])) {
         return $address_id;
     }
     if ($new_address_id = $this->Address->insert($_POST['client']['address'])) {
         // which type has to be changed?
         if ($this->GET['type'] == 'invoices') {
             $type = 'invoices';
             $other_type = 'delivery';
         } else {
             $type = 'delivery';
             $other_type = 'invoices';
         }
         $original_address = $_SESSION['client']['customer']["{$type}_address_id"];
         $other_address = $_SESSION['client']['customer']["{$other_type}_address_id"];
         $this->selectAddress($new_address_id, $type);
         // can delete only if not selected as other address type
         if ($original_address != $other_address) {
             $this->Address->deleteAddress($original_address);
         }
         msg("{$this->getAddressType()} address has been successfully updated.");
         onxshopGoto("page/{$_SESSION['active_pages'][0]}");
     } else {
         msg('Address is not valid', 'error');
         return false;
     }
 }
示例#6
0
 /**
  * save submitted form
  */
 public function processNewNotice(&$store, $node_id)
 {
     if (empty($_POST['notice']['text'])) {
         return false;
     }
     $image_path = false;
     if (is_uploaded_file($_FILES['image']['tmp_name'])) {
         $_FILES['image']['name'] = $store['title'] . '-' . $_FILES['image']['name'];
         $upload = $this->Image->getSingleUpload($_FILES['image'], 'var/files/notices/', true);
         if (is_string($upload)) {
             $image_path = $upload;
         }
     }
     $parts = explode("/", $_POST['notice']['visible_from'], 3);
     $unix_date = strtotime($parts[2] . "-" . $parts[1] . "-" . $parts[0]);
     $html = '';
     $html .= '<div class="date">' . date("d/m/y", $unix_date) . "</div>\n";
     $html .= '<div class="text">' . nl2br($_POST['notice']['text']) . "</div>\n";
     if ($image_path) {
         $html .= '<div class="image"><img src="/thumbnail/200x110/' . $image_path . '?method=crop" alt=""/></div>';
     }
     $node = array('title' => 'Store Notice', 'node_group' => 'content', 'node_controller' => 'notice', 'parent' => $node_id, 'parent_container' => 4, 'priority' => $unix_date, 'content' => $html, 'publish' => 0, 'display_in_menu' => 0, 'css_class' => 'store', 'other_data' => array('type' => 'store_notice', 'text' => $_POST['notice']['text'], 'visible_from' => $_POST['notice']['visible_from'], 'visible_to' => $_POST['notice']['visible_to'], 'image' => $image_path));
     $new_node_id = $this->Node->nodeInsert($node);
     if ($new_node_id && $image_path) {
         $this->Image->insertFile(array('src' => $image_path, 'role' => 'main', 'node_id' => $new_node_id, 'title' => 'Store Notice Image'));
     }
     $this->sendAlertEmail($store, $node['other_data']);
     if ($new_node_id) {
         onxshopGoto("/page/{$node_id}");
     }
 }