我正在使用 Magento CE 1.7。
我创建了一个 CMS 页面来添加“使用条款”,并在页面底部添加了一个简单的“接受条款”提交表单,让客户在访问我希望他们访问的页面之前同意这些条款. 这是代码。
<form action="url-to-go-to.html" method="GET" onsubmit="return checkCheckBox(this)">
I accept: <input type="checkbox" value="0" name="agree">
<input type="submit" value="Continue">
<input type="button" value="Exit" onclick="document.location.href='BACKTOWHAT.html';">
</form>
<script type="text/javascript">
<!--
function checkCheckBox(f){
if (f.agree.checked == false )
{
alert("Please tick the box to continue");
return false;
} else
return true;
}
-->
</script>
我唯一的问题是,我只能通过输入我希望他们重定向到的页面的 URL 来使其工作。IE
<form action="domainname.com/shop.html"> <!-- store section to go to -->
/* and the same goes for */
onclick="document.location.href='domainname.com';"> <!-- back to storefront -->
我想使用其他东西而不是 URL,但我不知道该怎么做。我认为使用这样的东西会起作用。
<form action="<?php echo $this->_redirect('shop.html'); ?>" method=.... >
但事实并非如此。
我相信如果这在一个 .phtml 文件中它会起作用,但我正在使用一个简单的 CMS 页面,我知道 magento 函数可以在 CMS 页面中工作,但我不知道一个可以用于此目的的函数。