比如带有creditcard-pay的url页面,修改下面几处,具体方法作用可以看注释
\app\code\core\Mage\Core\Model\Store.php
/**
* Check if frontend URLs should be secure
*
* @return boolean
*/
public function isFrontUrlSecure()
{
$pathInfo = Mage::app()->getRequest()->getPathInfo();//byfeng
if('/creditcard-pay'==$pathInfo){
return true;
}
if ($this->_isFrontSecure === null) {
$this->_isFrontSecure = Mage::getStoreConfigFlag(Mage_Core_Model_Url::XML_PATH_SECURE_IN_FRONT,
$this->getId());
}
return $this->_isFrontSecure;
}
\app\code\core\Mage\Core\Model\Design\Package.php
/**
* Prepare url for css replacement
*
* @param string $uri
* @return string
*/
protected function _prepareUrl($uri)
{
// check absolute or relative url
if (!preg_match('/^https?:/i', $uri) && !preg_match('/^\//i', $uri)) {
$fileDir = '';
$pathParts = explode(DS, $uri);
$fileDirParts = explode(DS, $this->_callbackFileDir);
$store = $this->getStore();
if ($store->isAdmin()) {
$secure = $store->isAdminUrlSecure();
} else {
$secure = $store->isFrontUrlSecure() && Mage::app()->getRequest()->isSecure();
}
$pathInfo = Mage::app()->getRequest()->getPathInfo();
if('/creditcard-pay'==$pathInfo){
$secure = true;
}
if ('skin' == $fileDirParts[0]) {
$baseUrl = Mage::getBaseUrl('skin', $secure);//byfeng 合并css文件里的url https
$fileDirParts = array_slice($fileDirParts, 1);
} elseif ('media' == $fileDirParts[0]) {
$baseUrl = Mage::getBaseUrl('media', $secure);
$fileDirParts = array_slice($fileDirParts, 1);
} else {
$baseUrl = Mage::getBaseUrl('web', $secure);
}
foreach ($pathParts as $key=>$part) {
if ($part == '.' || $part == '..') {
unset($pathParts[$key]);
}
if ($part == '..' && count($fileDirParts)) {
$fileDirParts = array_slice($fileDirParts, 0, count($fileDirParts) - 1);
}
}
if (count($fileDirParts)) {
$fileDir = implode('/', $fileDirParts).'/';
}
$uri = $baseUrl.$fileDir.implode('/', $pathParts);
}
return $uri;
}
\app\Mage.php
/**
* Get base URL path by type
*
* @param string $type
* @param null|bool $secure
* @return string
*/
public static function getBaseUrl($type = Mage_Core_Model_Store::URL_TYPE_LINK, $secure = null)
{
$pathInfo = self::app()->getRequest()->getPathInfo();
if('/creditcard-pay'==$pathInfo){
$secure = true;
}
return self::app()->getStore()->getBaseUrl($type, $secure);
}
|