本文整理汇总了PHP中ModuleFrontController类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleFrontController类的具体用法?PHP ModuleFrontController怎么用?PHP ModuleFrontController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleFrontController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$cart = $this->context->cart;
$baseSsl = Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__;
$this->context->smarty->assign(array('nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->module->getCurrency((int) $cart->id_currency), 'total' => $cart->getOrderTotal(true, Cart::BOTH), 'isoCode' => $this->context->language->iso_code, 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/', 'base_dir_ssl' => $baseSsl));
$currency = new Currency($this->context->cart->id_currency);
$step = isset($_GET['step']) ? $_GET['step'] : null;
switch ($step) {
case 'checkout':
$response = $this->module->checkout($cart->getOrderTotal(), $cart->id, $currency->iso_code, $this->context->customer->secure_key, $this->context->link->getModuleLink('mtgox', 'payment'));
if ($response['result'] == "success") {
header('Location: ' . $response['return']['payment_url']);
exit;
} else {
exit('Fatal error. Could not checkout. Please try again');
}
break;
case 'success':
return $this->setTemplate('success.tpl');
break;
case 'failure':
return $this->setTemplate('failure.tpl');
break;
case 'callback':
$this->module->parseIpn($_POST);
break;
default:
return $this->setTemplate('confirm.tpl');
break;
}
}
示例2: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
$this->display_column_left = false;
parent::initContent();
$this->context->smarty->assign(array('total' => $this->context->cart->getOrderTotal(true, Cart::BOTH), 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/'));
$this->setTemplate('validation.tpl');
}
示例3: initContent
public function initContent()
{
global $smarty;
parent::initContent();
$this->setTemplate('tppaymentform.tpl');
$smarty->assign(array('jslinkForm' => $this->getAmbientUrlForm(), 'publicKey' => $this->getPublicKey(), 'email' => $this->getMail(), 'name' => $this->getCompleteName(), 'orderId' => Tools::getValue('order')));
}
示例4: initContent
public function initContent()
{
parent::initContent();
//Generate Kwixo form
$this->context->smarty->assign(array('form' => KwixoFrontController::generateForm()));
$this->setTemplate('payment_execution.tpl');
}
示例5: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$shop_name = htmlentities(Configuration::get('PS_SHOP_NAME'), NULL, 'utf-8');
$shop_url = Tools::getHttpHost(true, true);
$customer = Context::getContext()->customer;
if (!preg_match("#.*\\.html\$#Ui", Tools::getValue('mail')) or !preg_match("#.*\\.html\$#Ui", Tools::getValue('mail'))) {
die(Tools::redirect());
}
$file = file_get_contents(dirname(__FILE__) . '/../../mails/' . strval(preg_replace('#\\.{2,}#', '.', Tools::getValue('mail'))));
$file = str_replace('{shop_name}', $shop_name, $file);
$file = str_replace('{shop_url}', $shop_url . __PS_BASE_URI__, $file);
$file = str_replace('{shop_logo}', $shop_url . _PS_IMG_ . 'logo.jpg', $file);
$file = str_replace('{firstname}', $customer->firstname, $file);
$file = str_replace('{lastname}', $customer->lastname, $file);
$file = str_replace('{email}', $customer->email, $file);
$file = str_replace('{firstname_friend}', 'XXXXX', $file);
$file = str_replace('{lastname_friend}', 'xxxxxx', $file);
$file = str_replace('{link}', 'authentication.php?create_account=1', $file);
$discount_type = (int) Configuration::get('REFERRAL_DISCOUNT_TYPE');
if ($discount_type == 1) {
$file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_PERCENTAGE'), $discount_type, new Currency($this->context->currency->id)), $file);
} else {
$file = str_replace('{discount}', Discount::display((double) Configuration::get('REFERRAL_DISCOUNT_VALUE_' . $this->context->currency->id), $discount_type, new Currency($this->context->currency->id)), $file);
}
$this->context->smarty->assign(array('content' => $file));
$this->setTemplate('email.tpl');
}
示例6: initContent
public function initContent()
{
parent::initContent();
$this->paypal = new PayPal();
$this->context = Context::getContext();
$this->id_module = (int) Tools::getValue('id_module');
$this->id_order = (int) Tools::getValue('id_order');
$order = new Order($this->id_order);
$order_state = new OrderState($order->current_state);
$paypal_order = PayPalOrder::getOrderById($this->id_order);
if ($order_state->template[$this->context->language->id] == 'payment_error') {
$this->context->smarty->assign(array('message' => $order_state->name[$this->context->language->id], 'logs' => array($this->paypal->l('An error occurred while processing payment.')), 'order' => $paypal_order, 'price' => Tools::displayPrice($paypal_order['total_paid'], $this->context->currency)));
return $this->setTemplate('error.tpl');
}
$order_currency = new Currency((int) $order->id_currency);
$display_currency = new Currency((int) $this->context->currency->id);
$price = Tools::convertPriceFull($paypal_order['total_paid'], $order_currency, $display_currency);
$this->context->smarty->assign(array('is_guest' => $this->context->customer->is_guest || $this->context->customer->id == false, 'order' => $paypal_order, 'price' => Tools::displayPrice($price, $this->context->currency->id), 'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(), 'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn()));
if ($this->context->customer->is_guest || $this->context->customer->id == false) {
$this->context->smarty->assign(array('id_order' => (int) $this->id_order, 'id_order_formatted' => sprintf('#%06d', (int) $this->id_order), 'order_reference' => $order->reference));
/* If guest we clear the cookie for security reason */
$this->context->customer->mylogout();
}
if ($this->context->getMobileDevice() == true) {
$this->setTemplate('order-confirmation-mobile.tpl');
} else {
$this->setTemplate('order-confirmation.tpl');
}
}
示例7: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
try {
if (!Maestrano::param('connec.enabled')) {
return false;
}
$client = new Maestrano_Connec_Client();
$notification = json_decode(file_get_contents('php://input'), false);
$entity_name = strtoupper(trim($notification->entity));
$entity_id = $notification->id;
switch ($entity_name) {
case "PERSONS":
$customerMapper = new CustomerMapper();
$customerMapper->fetchConnecResource($entity_id);
break;
case "ITEMS":
$productMapper = new ProductMapper();
$productMapper->fetchConnecResource($entity_id);
break;
case "TAXCODES":
$taxMapper = new TaxMapper();
$taxMapper->fetchConnecResource($entity_id);
break;
}
} catch (Exception $e) {
error_log("Caught exception in subscribe " . json_encode($e->getMessage()));
}
}
示例8: init
public function init()
{
parent::init();
require_once $this->module->getLocalPath() . 'MailAlert.php';
$this->id_product = (int) Tools::getValue('id_product');
$this->id_product_attribute = (int) Tools::getValue('id_product_attribute');
}
示例9: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
$this->display_column_left = false;
$link = new Link();
parent::initContent();
$this->setTemplate('warning_page.tpl');
}
示例10: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
parent::initContent();
$id_cart = Tools::GetValue('id_cart');
$cart = new Cart((int) $id_cart);
$liqpay = new Liqpay();
$total = $cart->getOrderTotal(true, 3);
$liqpay->validateOrder(intval($cart->id), Configuration::get('PS_OS_PREPARATION'), $total, $liqpay->displayName);
$currency = new Currency((int) $cart->id_currency);
$private_key = Configuration::get('LIQPAY_PRIVATE_KEY');
$public_key = Configuration::get('LIQPAY_PUBLIC_KEY');
$amount = number_format($cart->getOrderTotal(true, Cart::BOTH), 1, '.', '');
$currency = $currency->iso_code == 'RUR' ? 'RUB' : $currency->iso_code;
$order_id = '000' . $id_cart;
$description = 'Order #' . $order_id;
$result_url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'index.php?controller=history';
$server_url = 'http://' . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . $liqpay->getPath() . 'validation.php';
$type = 'buy';
$version = '3';
$language = Configuration::get('PS_LOCALE_LANGUAGE') == 'en' ? 'en' : 'ru';
$data = base64_encode(json_encode(array('version' => $version, 'public_key' => $public_key, 'amount' => $amount, 'currency' => $currency, 'description' => $description, 'order_id' => $order_id, 'type' => $type, 'language' => $language)));
$signature = base64_encode(sha1($private_key . $data . $private_key, 1));
$this->context->smarty->assign(compact('data', 'signature'));
$this->setTemplate('redirect.tpl');
}
示例11: initContent
public function initContent()
{
parent::initContent();
$params = KwixoURLCallFrontController::ManageUrlCall();
$payment_ok = $params['payment_status'];
$errors = $params['errors'];
$id_order = $params['id_order'];
if ($id_order != false) {
$order = new Order($id_order);
$cart = new Cart($order->id_cart);
$products = $cart->getProducts();
$amount = $order->total_paid_tax_incl;
$total_shipping = $order->total_shipping;
} else {
$products = false;
$amount = false;
$total_shipping = false;
}
$link = new Link();
$this->context->smarty->assign('payment_ok', $payment_ok);
$this->context->smarty->assign('errors', $errors);
$this->context->smarty->assign('amount', $amount);
$this->context->smarty->assign('total_shipping', $total_shipping);
$this->context->smarty->assign('products', $products);
$this->context->smarty->assign('path_order', $link->getPageLink('order', true));
$this->context->smarty->assign('path_history', $link->getPageLink('history', true));
$this->context->smarty->assign('path_contact', $link->getPageLink('contact', true));
$this->setTemplate('urlcall.tpl');
}
示例12: initContent
public function initContent()
{
parent::initContent();
$cart = $this->context->cart;
$this->context->smarty->assign(array('payment_status' => $this->module->payment_status, 'nbProducts' => $cart->nbProducts(), 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/', 'errors' => $this->errors));
$this->setTemplate('error.tpl');
}
示例13: initContent
public function initContent()
{
parent::initContent();
$ordernumber = Tools::getValue('InvId');
$this->context->smarty->assign('ordernumber', $ordernumber);
if (Configuration::get('robokassa_postvalidate')) {
if (!$ordernumber) {
robokassa::validateAnsver($this->module->l('Cart number is not set'));
}
$cart = new Cart((int) $ordernumber);
if (!Validate::isLoadedObject($cart)) {
robokassa::validateAnsver($this->module->l('Cart does not exist'));
}
if (!($ordernumber = Order::getOrderByCartId($cart->id))) {
$this->setTemplate('waitingPayment.tpl');
}
}
if (!$ordernumber) {
robokassa::validateAnsver($this->module->l('Order number is not set'));
}
$order = new Order((int) $ordernumber);
if (!Validate::isLoadedObject($order)) {
robokassa::validateAnsver($this->module->l('Order does not exist'));
}
$customer = new Customer((int) $order->id_customer);
if ($customer->id != $this->context->cookie->id_customer) {
robokassa::validateAnsver($this->module->l('You are not logged in'));
}
if ($order->hasBeenPaid()) {
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id);
} else {
$this->setTemplate('waitingPayment.tpl');
}
}
示例14: initContent
public function initContent()
{
$meta = array();
parent::initContent();
$colums = Context::getContext()->theme->hasColumns(Context::getContext()->controller->page_name);
if ($colums) {
$hide_column_left = isset($colums['left_column']) && !empty($colums['left_column']) ? 0 : 1;
$hide_column_right = isset($colums['right_column']) && !empty($colums['right_column']) ? 0 : 1;
}
/* if ( Tools::getvalue('id_category') && Tools::getvalue('id_category') != Null) {
$this->context->smarty->assign(BlogCategory::GetMetaByCategory(Tools::getvalue('id_category')));
}
if (Tools::getvalue('id_post') && Tools::getvalue('id_post') != Null) {
$this->context->smarty->assign(SmartBlogPost::GetPostMetaByPost(Tools::getvalue('id_post')));
}
if (Tools::getvalue('id_category') == Null && Tools::getvalue('id_post') == Null) {
$meta['meta_title'] = Configuration::get('smartblogmetatitle');
$meta['meta_description'] = Configuration::get('smartblogmetadescrip');
$meta['meta_keywords'] = Configuration::get('smartblogmetakeyword');
$this->context->smarty->assign($meta);
}
*/
$this->context->smarty->assign($meta);
if (Configuration::get('smartshowcolumn') == 0) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'hide_right_column' => '', 'hide_left_column' => '', 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
} elseif (Configuration::get('smartshowcolumn') == 1) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'hide_right_column' => '1', 'hide_left_column' => '', 'HOOK_RIGHT_COLUMN' => ''));
} elseif (Configuration::get('smartshowcolumn') == 2) {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => '', 'hide_right_column' => '', 'hide_left_column' => '1', 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
} elseif (Configuration::get('smartshowcolumn') == 3) {
$this->context->smarty->assign(array('hide_right_column' => $hide_column_right, 'hide_left_column' => $hide_column_left));
} else {
$this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('displaySmartBlogLeft'), 'hide_right_column' => '', 'hide_left_column' => '', 'HOOK_RIGHT_COLUMN' => Hook::exec('displaySmartBlogRight')));
}
}
示例15: initContent
public function initContent()
{
parent::initContent();
$id = $_GET['id'];
$id_lang = $this->context->language->id;
$product = new Product((int) $id);
$link = new Link();
$url = $link->getProductLink($product);
$features = Db::getInstance()->ExecuteS('
SELECT fl.name feature_name, fvl.value feature_value
FROM ' . _DB_PREFIX_ . 'feature_product fp
LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang=' . $id_lang . ' )
LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang=' . $id_lang . ')
WHERE fp.id_product=' . $id);
// print_r($features);
$images = Image::getImages((int) $id_lang, (int) $product->id);
//Limitamos el numero de fotos a cuatro solamente
while (count($images) > 3) {
$var = array_pop($images);
}
$this->context->smarty->assign(array('product' => $product, 'lang' => $id_lang, 'image' => $images, 'dir' => Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/pdfproduct', 'email' => Configuration::get('PS_SHOP_EMAIL'), 'url' => $url, 'address' => Configuration::get('ADDRESS_SHOP'), 'background' => Configuration::get('BACKGROUND')));
$html = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'pdfproduct/views/templates/front/custom_template_content.tpl');
$dompdf = new DOMPDF();
$dompdf->set_option('enable_remote', TRUE);
$dompdf->load_html($html);
$dompdf->set_paper('a4', 'portrait');
$dompdf->render();
$dompdf->stream('producto');
//$this->setTemplate('custom_template_content.tpl');
//file_put_contents($filename, $dompdf->output());
//$pdf = new PDF($product, 'CustomPdf', Context::getContext()->smarty);
//$img_file = Tools::getHttpHost(true).__PS_BASE_URI__. '/modules/pdfproduct/views/images/background.jpg';
//$pdf->pdf_renderer->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
//$pdf->render();
}