这部分代码在我的“products_list.tpl”文件中没有正确执行。
{* Show Edit button for administrators *}
{if $obj->mShowEditButton}
<form action="{$obj->mEditActionTarget}" target="_self" method="post" class="edit-form">
<input type="hidden" name="product_id" value="{$obj->mProducts[k].product_id}" />
<input type="submit" name="submit" value="Edit Product Details" />
</form>
{/if}
它正在返回这个
<form action="http://phpcs5/regional-d1" target="_self" method="post" class="edit-form">
<input type="hidden" name="product_id" value="10" />
<input type="submit" name="submit" value="Edit Product Details" />
</form>
而不是(所需的输出)
<form action="http://phpcs5/" target="_self" method="post" class="edit-form">
<input type="hidden" name="product_id" value="3" />
<input type="submit" name="submit" value="Edit Product Details" />
</form>
谁能帮帮我吗?我可以给你任何你问的细节。谢谢你。
这里是:
public function init() {
// Prepare the Edit button
$this->mEditActionTarget = Link::Build(str_replace(VIRTUAL_LOCATION, '', getenv('REQUEST_URI')));
if (isset($_SESSION['admin_logged'])
&& $_SESSION['admin_logged'] == true
&& isset($_POST['product_id'])) {
if (isset($this->_mDepartmentId)
&& isset($this->_mCategoryId)) {
header('Location: ' . htmlspecialchars_decode(
Link::ToProductAdmin($this->_mDepartmentId,
$this->_mCategoryId,
(int)$_POST['product_id'])));
}
else {
$product_locations = Catalog::GetProductLocations((int)$_POST['product_id']);
if (count($product_locations) > 0) {
$department_id = $product_locations[0]['department_id'];
$category_id = $product_locations[0]['category_id'];
header('Location: ' . htmlspecialchars_decode(
Link::ToProductAdmin($department_id,
$category_id,
(int)$_POST['product_id'])));
}
}
}
}