Beispiel #1
0
 private function getTemplate($params)
 {
     $sql = "\n\t\t\tSELECT body\n\t\t\tFROM email_body\n\t\t\tWHERE template='" . $this->template . "'\n\t\t";
     $message = $this->registry->db->getRow($sql);
     if (PEAR::isError($message)) {
         $this->registry->Error($message->getMessage(), $message->getDebugInfo());
         $this->setMailBody(PEAR::raiseError('Database query failed.'));
     } else {
         $message->body = Uthando::templateParser($message->body, $params, '####', '####');
         $this->setMailBody($message->body);
     }
 }
Beispiel #2
0
 public function displayCartInvoice($user)
 {
     $html = file_get_contents('ushop/html/invoice.html', true);
     $cart = $this->retrieveCart();
     $user_info = $this->getUserInfo($user);
     $params = array('CART' => $cart->displayCart(), 'USER_INFO' => $user_info['info'], 'USER_CDA' => $user_info['cda'], 'USER_EMAIL' => $user_info['email'], 'MERCHANT_DETAILS' => $this->getMerchantInfo());
     $html = Uthando::templateParser($html, $params, '{', '}');
     $html = preg_replace("/<th>(.*?)<\\/th>/s", "", $html);
     $remove = array('delete_item', 'item_quantity_input');
     if (!$this->invoice['display_top']) {
         $remove[] = 'top';
     }
     if (!$this->invoice['display_bottom']) {
         $remove[] = "bottom";
     }
     foreach ($remove as $value) {
         $html = UShop_Utility::removeSection($html, $value);
     }
     return $html;
 }
Beispiel #3
0
 public function displayCart()
 {
     global $uthando;
     $cb = file_get_contents('ushop/html/cart_body.html', true);
     $ci = file_get_contents('ushop/html/cart_items.html', true);
     if (!$uthando->ushop->checkout['vat_state']) {
         $ci = UShop_Utility::removeSection($ci, 'vat');
     }
     if (!$uthando->ushop->checkout['vat_state']) {
         $cb = UShop_Utility::removeSection($cb, 'vat');
     }
     $params = array('COLSPAN' => $uthando->ushop->checkout['vat_state'] == 1 ? 3 : 2, 'CART_ITEMS' => null);
     $items = $this->calculateCartItems();
     if (is_array($items)) {
         foreach ($items as $item) {
             $tr = Uthando::templateParser($ci, $item, '{', '}');
             $params['CART_ITEMS'] .= $tr;
         }
         if (isset($_SESSION['CountryCode'])) {
             $this->calculatePostage();
         } else {
             $this->cart['postCost'] = 0;
             $this->cart['postTax'] = 0;
             $cb = UShop_Utility::removeSection($cb, 'postage');
         }
         $params = array_merge($params, $this->getCartTotals());
         $html = Uthando::templateParser($cb, $params, '{', '}');
     } else {
         $html = $items;
     }
     return $html;
 }