本文整理汇总了PHP中Mage::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getUrl方法的具体用法?PHP Mage::getUrl怎么用?PHP Mage::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRemoveUrl
public function getRemoveUrl()
{
/** @var $category Mage_Catalog_Model_Category */
$category = Mage::registry('current_category');
/** @var $landingPage Hackathon_Layeredlanding_Model_Layeredlanding */
$landingPage = Mage::registry('current_landingpage');
if ($category->getId() && $landingPage && $landingPage->getId()) {
$query = array($this->getFilter()->getRequestVar() => $this->getFilter()->getResetValue());
$params['_current'] = true;
$params['_use_rewrite'] = true;
$params['_query'] = $query;
$params['_escape'] = true;
$attributeModel = Mage::getModel('eav/entity_attribute')->loadByCode(10, $this->getFilter()->getRequestVar());
$attributeIds = array();
foreach ($landingPage->getAttributes() as $attribute) {
$attributeIds[] = $attribute->getAttributeId();
}
if ($attributeModel->getId() && in_array($attributeModel->getAttributeId(), $attributeIds)) {
$parameters = parse_url(Mage::getUrl('*/*/*', $params), PHP_URL_QUERY);
$categoryUrl = parse_url($category->getUrl(), PHP_URL_PATH);
return sprintf('%s?%s', $categoryUrl, $parameters);
}
return Mage::getUrl('*/*/*', $params);
}
return parent::getRemoveUrl();
}
示例2: _toHtml
protected function _toHtml()
{
$rssObj = Mage::getModel('rss/rss');
$order = Mage::registry('current_order');
$title = Mage::helper('rss')->__('Order # %s Notification(s)', $order->getIncrementId());
$newurl = Mage::getUrl('sales/order/view', array('order_id' => $order->getId()));
$data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8');
$rssObj->_addHeader($data);
$resourceModel = Mage::getResourceModel('rss/order');
$results = $resourceModel->getAllCommentCollection($order->getId());
if ($results) {
foreach ($results as $result) {
$urlAppend = 'view';
$type = $result['entity_type_code'];
if ($type && $type != 'order') {
$urlAppend = $type;
}
$type = Mage::helper('rss')->__(ucwords($type));
$title = Mage::helper('rss')->__('Details for %s #%s', $type, $result['increment_id']);
$description = '<p>' . Mage::helper('rss')->__('Notified Date: %s<br/>', $this->formatDate($result['created_at'])) . Mage::helper('rss')->__('Comment: %s<br/>', $result['comment']) . '</p>';
$url = Mage::getUrl('sales/order/' . $urlAppend, array('order_id' => $order->getId()));
$data = array('title' => $title, 'link' => $url, 'description' => $description);
$rssObj->_addEntry($data);
}
}
$title = Mage::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt()));
$url = Mage::getUrl('sales/order/view', array('order_id' => $order->getId()));
$description = '<p>' . Mage::helper('rss')->__('Current Status: %s<br/>', $order->getStatusLabel()) . Mage::helper('rss')->__('Total: %s<br/>', $order->formatPrice($order->getGrandTotal())) . '</p>';
$data = array('title' => $title, 'link' => $url, 'description' => $description);
$rssObj->_addEntry($data);
return $rssObj->createRssXml();
}
示例3: sendMailAuthentication
public function sendMailAuthentication($email, $method)
{
//random code
$account = Mage::getSingleton('affiliateplus/session')->getAccount();
$length = 6;
$charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$str = '';
if ($this->getId()) {
$str = $this->getInfo();
} else {
$count = strlen($charset);
while ($length--) {
$str .= $charset[mt_rand(0, $count - 1)];
}
}
$sendTo = array('email' => $email, 'name' => $account->getName());
$store = Mage::app()->getStore();
/*send authentication code to email*/
$link = Mage::getUrl('*/*/verifyCode', array('account_id' => $account->getId(), 'payment_method' => $method, 'email' => $email, 'authentication_code' => $str, 'from' => 'email'));
$translate = Mage::getSingleton('core/translate');
$translate->setTranslateInline(false);
$template = Mage::getStoreConfig(self::TEMPLATE_VERIFY_EMAIL, $store->getId());
$sender = Mage::helper('affiliateplus')->getSenderContact();
$mailSubject = 'Verify Email Payment';
$mailTemplate = Mage::getModel('core/email_template');
try {
$mailTemplate->setEmailSubject($mailSubject)->sendTransactional($template, $sender, $sendTo['email'], $sendTo['name'], array('store' => $store, 'sender_name' => $sender['name'], 'code' => $str, 'link' => $link, 'name' => $account->getName()), $store->getId());
return $str;
$translate->setTranslateInline(true);
} catch (Exception $e) {
}
return;
/*edit send mail*/
}
示例4: match
public function match(Zend_Controller_Request_Http $request)
{
if (!Mage::isInstalled()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
exit;
}
$identifier = trim($request->getPathInfo(), '/');
/* @var $parser Hackathon_Layeredlanding_Model_Layeredlanding */
$landingPage = Mage::getModel('layeredlanding/layeredlanding')->loadByUrl($identifier);
if (!$landingPage->getId()) {
return false;
}
Mage::register('current_landingpage', $landingPage);
Mage::app()->getStore()->setConfig(Mage_Catalog_Helper_Category::XML_PATH_USE_CATEGORY_CANONICAL_TAG, 0);
// disable canonical tag
// if successfully gained url parameters, use them and dispatch ActionController action
$categoryIdsValue = $landingPage->getCategoryIds();
$categoryIds = explode(',', $categoryIdsValue);
$firstCategoryId = $categoryIds[0];
$request->setRouteName('catalog')->setModuleName('catalog')->setControllerName('category')->setActionName('view')->setParam('id', $firstCategoryId);
/** @var $attribute Hackathon_Layeredlanding_Model_Attributes */
foreach ($landingPage->getAttributes() as $attribute) {
$attr = Mage::getModel('eav/entity_attribute')->load($attribute->getAttributeId());
$request->setParam($attr->getAttributeCode(), $attribute->getValue());
}
$controllerClassName = $this->_validateControllerClassName('Mage_Catalog', 'category');
$controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $this->getFront()->getResponse());
$request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
// dispatch action
$request->setDispatched(true);
$controllerInstance->dispatch('view');
return true;
}
示例5: initSession
private function initSession($order, $enc_key, $itemid)
{
$paytype = Mage::getStoreConfig('payment/payture/paytype');
$request = array('SessionType' => $paytype, 'OrderId' => $order->getId(), 'Amount' => $order->getGrandTotal() * 100, 'Total' => $order->getGrandTotal(), 'IP' => $order->getRemoteIp(), 'Url' => Mage::getUrl('payture/payment/result/', array('_secure' => true, 'order' => $enc_key)));
//add product names
$products = '';
$items = $order->getItemsCollection();
foreach ($items as $item) {
if ($item->getOriginalPrice() > 0) {
$products .= $item->getName() . ', ';
}
}
if (substr($products, strlen($products) - 2, 2) == ', ') {
$products = substr($products, 0, strlen($products) - 2);
}
$request['Product'] = $products;
$result = $this->requestApiGet(Mage::helper('payture')->getHost() . 'Init', $request);
Mage::helper('payture')->addLog($result);
$xml = simplexml_load_string($result);
if ((bool) $xml["Success"][0] == true) {
if ($xml["SessionId"][0]) {
$item = Mage::getModel('payture/keys')->load($itemid);
$item->setSessionid($xml["SessionId"][0]);
$item->setPaytype($paytype);
$item->setState('New');
$item->setDate(Mage::getModel('core/date')->date('Y-m-d H:i:s'));
$item->save();
return $xml["SessionId"][0];
}
} else {
$session = Mage::getSingleton('checkout/session');
$session->addError($xml["ErrCode"][0]);
return false;
}
}
示例6: doGeneralAssert
public function doGeneralAssert($textToCheck)
{
$this->assertContains(Mage::getUrl('checkout/cart'), $textToCheck);
$this->assertContains(Mage::getUrl('checkout'), $textToCheck);
$this->assertContains(Mage::getUrl('customer/account'), $textToCheck);
$this->assertContains("</body>", $textToCheck);
}
示例7: getSavePdfUrl
public function getSavePdfUrl($front = 'aitcg')
{
if (Mage::app()->getStore()->getConfig('catalog/aitcg/aitcg_enable_svg_to_pdf') == 1) {
return Mage::getUrl($front . '/index/pdf');
}
return false;
}
示例8: indexAction
public function indexAction()
{
echo "<h2>This tests points expiry </h2>";
echo "<a href='" . Mage::getUrl('rewards/debug_expiry/testCron') . "'>Run Daily Cron Expiry Check</a> - This will send out any e-mails, write to any logs, expire any points, etc. <BR />";
echo "<a href='" . Mage::getUrl('rewards/debug_expiry/expirePoints') . "'>VIEW points balance expiry info for customer id #1 </a> (or customer id specified as customer_id in the url param)<BR />";
exit;
}
示例9: authorizeAction
/**
* Authorize Login Token
*
* Create account and/or log user in.
*/
public function authorizeAction()
{
$token = $this->getRequest()->getParam('token');
if (!$token) {
$token = $this->getRequest()->getParam('access_token');
}
if ($token) {
$customer = Mage::getModel('amazon_login/customer')->loginWithToken($token);
if ($customer->getId()) {
$this->_redirectUrl(Mage::helper('customer')->getDashboardUrl());
} else {
Mage::getSingleton('customer/session')->addError('Unable to log in with Amazon.');
if ($referer = $this->getRequest()->getParam(Mage_Customer_Helper_Data::REFERER_QUERY_PARAM_NAME)) {
$referer = Mage::helper('core')->urlDecode($referer);
$this->_redirectUrl($referer);
}
}
} else {
if ($error = $this->getRequest()->getParam('error_description')) {
Mage::getSingleton('customer/session')->addError('Unable to log in with Amazon: ' . htmlspecialchars($error));
$this->_redirectUrl(Mage::getUrl(''));
} else {
$this->loadLayout();
$this->_initLayoutMessages('customer/session');
$this->renderLayout();
}
}
}
示例10: AutoSubmit
protected function AutoSubmit()
{
$oOrder = $this->_getOrder();
$oBilling = $oOrder->getBillingAddress();
$szHtml = '';
if ($oOrder) {
try {
$oPayment = new AllInOne();
$oPayment->ServiceURL = $this->_getConfigData('test_mode') ? 'http://payment-stage.allpay.com.tw/Cashier/AioCheckOut' : 'https://payment.allpay.com.tw/Cashier/AioCheckOut';
$oPayment->HashKey = $this->_getConfigData('hash_key');
$oPayment->HashIV = $this->_getConfigData('hash_iv');
$oPayment->MerchantID = $this->_getConfigData('merchant_id');
$oPayment->Send['ReturnURL'] = Mage::getUrl('alipay/processing/response');
$oPayment->Send['ClientBackURL'] = Mage::getUrl('');
$oPayment->Send['OrderResultURL'] = Mage::getUrl('alipay/processing/result');
$oPayment->Send['MerchantTradeNo'] = ($this->_getConfigData('test_mode') ? $this->_getConfigData('test_order_prefix') : '') . $oOrder->getIncrementId();
$oPayment->Send['MerchantTradeDate'] = date('Y/m/d H:i:s');
$oPayment->Send['TotalAmount'] = (int) $oOrder->getGrandTotal();
$oPayment->Send['TradeDesc'] = "AllPay_Magento_Module";
$oPayment->Send['ChoosePayment'] = PaymentMethod::Alipay;
$oPayment->Send['Remark'] = '';
$oPayment->Send['ChooseSubPayment'] = PaymentMethodItem::None;
$oPayment->Send['NeedExtraPaidInfo'] = ExtraPaymentInfo::No;
$oPayment->Send['DeviceSource'] = DeviceType::PC;
array_push($oPayment->Send['Items'], array('Name' => Mage::helper('alipay')->__('Commodity Group'), 'Price' => (int) $oOrder->getGrandTotal(), 'Currency' => Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol(), 'Quantity' => 1, 'URL' => ''));
$oPayment->SendExtend['Email'] = $oBilling->getEmail();
$oPayment->SendExtend['PhoneNo'] = $oBilling->getTelephone();
$oPayment->SendExtend['UserName'] = $oBilling->getName();
$szHtml = $oPayment->CheckOutString();
} catch (Exception $e) {
Mage::throwException($e->getMessage());
}
}
return $szHtml;
}
示例11: __construct
public function __construct()
{
$this->_config = new Google_Client();
$this->_config->setClientId(Mage::helper('sociallogin')->getGoConsumerKey());
$this->_config->setClientSecret(Mage::helper('sociallogin')->getGoConsumerSecret());
$this->_config->setRedirectUri(Mage::getUrl('sociallogin/gologin/user'));
}
示例12: offpayOption
public function offpayOption($observer)
{
$order = $observer->getEvent()->getOrder();
if ($_REQUEST['payment']['method'] == 'offlinepay') {
$order->setData('offpaytype', $_REQUEST['payment']['offtype']);
if ($_REQUEST['payment']['offtype'] == 1) {
$storeId = $order->getStore()->getId();
$data = $order->getData();
if (!Mage::helper('sales')->canSendNewOrderEmail($storeId)) {
return $order;
}
// Get the destination email addresses to send copies to
$copyTo = $order->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
$copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
// Start store emulation process
$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
try {
// Retrieve specified view block from appropriate design package (depends on emulated store)
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true);
$paymentBlock->getMethod()->setStore($storeId);
$paymentBlockHtml = $paymentBlock->toHtml();
} catch (Exception $exception) {
// Stop store emulation process
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
throw $exception;
}
// Stop store emulation process
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
$customerName = $order->getCustomerName();
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($order->getCustomerEmail(), $customerName);
if ($copyTo && $copyMethod == 'bcc') {
// Add bcc to customer email
foreach ($copyTo as $email) {
$emailInfo->addBcc($email);
}
}
$mailer->addEmailInfo($emailInfo);
// Email copies are sent as separated emails if their copy method is 'copy'
if ($copyTo && $copyMethod == 'copy') {
foreach ($copyTo as $email) {
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($email);
$mailer->addEmailInfo($emailInfo);
}
}
$templateId = 22;
// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId($templateId);
$mailer->setTemplateParams(array('order' => $order, 'billing' => $order->getBillingAddress(), 'payment_html' => $paymentBlockHtml, 'paypalurl' => Mage::getUrl('offlinepay/redirect/index', array('orderid' => $data['increment_id']))));
$mailer->send();
$order->setEmailSent(true);
$order->_getResource()->saveAttribute($order, 'email_sent');
}
}
}
示例13: indexAction
public function indexAction()
{
//validate if ajax request
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
//redirect request if not login, this will not work if the ajax is requested
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array("PLEASE LOGIN!")));
}
//declare the store_id and customer_id
$customer_id = Mage::getSingleton('customer/session')->getId();
$store_id = Mage::app()->getStore()->getStoreId();
//popup content
$model = Mage::getModel("singpost_login/profile");
$data = $model->getNotification();
//check if close forever
$notif_logs = $model->getNotificationLogs($customer_id);
//check login count
$login_count = $model->getUserLogCount($customer_id, $store_id);
//insert to array and response as json
$array = array('content' => stripcslashes($data[0]['content']), 'event' => $notif_logs, 'login_count' => $login_count['count']);
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($array));
} else {
//url request send back to the redirect
Mage::app()->getResponse()->setRedirect(Mage::getUrl('customer/account/login'));
}
}
示例14: _toHtml
protected function _toHtml()
{
//store id is store view id
$storeId = $this->_getStoreId();
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
//customer group id
$custGroup = $this->_getCustomerGroupId();
$newurl = Mage::getUrl('rss/catalog/salesrule');
$title = Mage::helper('rss')->__('%s - Discounts and Coupons', Mage::app()->getStore($storeId)->getName());
$lang = Mage::getStoreConfig('general/locale/code');
$rssObj = Mage::getModel('rss/rss');
$data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8', 'language' => $lang);
$rssObj->_addHeader($data);
$now = date('Y-m-d');
$_saleRule = Mage::getModel('salesrule/rule');
$collection = $_saleRule->getResourceCollection()->addFieldToFilter('from_date', array('date' => true, 'to' => $now))->addFieldToFilter('website_ids', array('finset' => $websiteId))->addFieldToFilter('customer_group_ids', array('finset' => $custGroup))->addFieldToFilter('is_rss', 1)->addFieldToFilter('is_active', 1)->setOrder('from_date', 'desc');
$collection->getSelect()->where('to_date is null or to_date>=?', $now);
$collection->load();
$url = Mage::getUrl('');
foreach ($collection as $sr) {
$description = '<table><tr>' . '<td style="text-decoration:none;">' . $sr->getDescription() . '<br/>Discount Start Date: ' . $this->formatDate($sr->getFromDate(), 'medium') . ($sr->getToDate() ? '<br/>Discount End Date: ' . $this->formatDate($sr->getToDate(), 'medium') : '') . ($sr->getCouponCode() ? '<br/> Coupon Code: ' . $sr->getCouponCode() . '' : '') . '</td>' . '</tr></table>';
$data = array('title' => $sr->getName(), 'description' => $description, 'link' => $url);
$rssObj->_addEntry($data);
}
return $rssObj->createRssXml();
}
示例15: getVouchersUrl
/**
* get the url to the voucher list page
* @access public
* @return string
* @author Ultimate Module Creator
*/
public function getVouchersUrl()
{
if ($listKey = Mage::getStoreConfig('instapago_voucher/voucher/url_rewrite_list')) {
return Mage::getUrl('', array('_direct' => $listKey));
}
return Mage::getUrl('instapago_voucher/voucher/index');
}