我的Joomla 3 mijoshop购物车在购买SEF后购买时没有出现问题,如果我将SEF关闭则可以正常工作。经过一番搜索我相信这可能是购物车router.php文件的问题,所以我想知道是否有人可以帮我解决这个问题。我已粘贴下面的当前router.php文件代码。
defined('_JEXEC') or die ('Restricted access');
require_once(JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php');
if (!class_exists('MiwisoftComponentRouterBase')) {
if (class_exists('JComponentRouterBase')) {
abstract class MiwisoftComponentRouterBase extends JComponentRouterBase {}
}
else {
class MiwisoftComponentRouterBase {}
}
}
class MijoShopRouter extends MiwisoftComponentRouterBase
{
static $cats = array();
static $path = array();
public function build(&$query) {
return $this->buildRoute($query);
}
public function parse(&$segments) {
return $this->parseRoute($segments);
}
public function buildRoute(&$query)
{
$Itemid = null;
$segments = array();
$menu = $this->getMenu();
$_get_itemid = 0;
if($menu->getActive()){
$_get_itemid = $menu->getActive()->id;
}
$_get_route = JRequest::getVar('route', '');
if( isset($query['Itemid']) and $_get_itemid != $query['Itemid'] and $_get_route == 'product/category' and isset($query['route']) and $query['route'] == 'product/product' ){
$query['Itemid'] = $_get_itemid;
}
if (!empty($query['Itemid'])) {
$Itemid = $query['Itemid'];
} else {
$Itemid = $this->getItemid();
}
if (empty($Itemid)) {
$a_menu = $menu->getActive();
} else {
$a_menu = $menu->getItem($Itemid);
}
if (isset($query['view'])) {
if ($query['view'] == 'admin') {
unset($query['view']);
return $segments;
}
$_route = $this->getRoute($query['view'], false);
if (!empty($_route)) {
$query['route'] = $_route;
unset($query['view']);
}
else {
$segments[] = $query['view'];
unset($query['view']);
}
}
if (isset($query['route'])) {
switch ($query['route']) {
case 'product/product':
if (is_object($a_menu) and $a_menu->query['view'] == 'product' and $a_menu->query['product_id'] == @$query['product_id']) {
unset($query['path']);
unset($query['product_id']);
unset($query['manufacturer_id']);
break;
}
$segments[] = 'product';
if (isset($query['product_id'])) {
$id = $query['product_id'];
$name = MijoShop::get('db')->getRecordAlias($id);
if (!empty($name)) {
$segments[] = $id . ':' . $name;
} else {
$segments[] = $id;
}
unset($query['path']);
unset($query['product_id']);
unset($query['manufacturer_id']);
unset($query['sort']);
unset($query['order']);
unset($query['filter_name']);
unset($query['filter_tag']);
unset($query['limit']);
unset($query['page']);
}
break;
case 'product/category':
$_path = explode('_', @$query['path']);
$m_id = end($_path);
if (is_object($a_menu) and $a_menu->query['view'] == 'category' and $a_menu->query['path'] == $m_id) {
unset($query['path']);
break;
}
$segments[] = 'category';
if (isset($query['path'])) {
$id = $query['path'];
if (strpos($id, '_')) {
$old_id = $id;
$_id = explode('_', $id);
$id = end($_id);
self::$cats[$id] = $old_id;
} else {
self::$cats[$id] = $id;
}
$name = MijoShop::get('db')->getRecordAlias($id, 'category');
if (!empty($name)) {
$segments[] = $id . ':' . $name;
} else {
$segments[] = $id;
}
unset($query['path']);
}
break;
case 'product/manufacturer/info':
if (is_object($a_menu) and $a_menu->query['view'] == 'manufacturer' and $a_menu->query['manufacturer_id'] == @$query['manufacturer_id']) {
unset($query['manufacturer_id']);
break;
}
$segments[] = 'manufacturer';
if (isset($query['manufacturer_id'])) {
$id = $query['manufacturer_id'];
$name = MijoShop::get('db')->getRecordAlias($id, 'manufacturer');
if (!empty($name)) {
$segments[] = $id . ':' . $name;
} else {
$segments[] = $id;
}
unset($query['manufacturer_id']);
}
break;
case 'information/information':
if (is_object($a_menu) and $a_menu->query['view'] == 'information' and $a_menu->query['information_id'] == @$query['information_id']) {
unset($query['information_id']);
break;
}
$segments[] = 'information';
if (isset($query['information_id'])) {
$id = $query['information_id'];
$name = MijoShop::get('db')->getRecordAlias($id, 'information');
if (!empty($name)) {
$segments[] = $id . ':' . $name;
} else {
$segments[] = $id;
}
unset($query['information_id']);
}
提前感谢任何可以提供帮助的人:)
答案 0 :(得分:0)
问题与您的router.php文件无关,它与结帐流程有关,因为这些购物车项目实际存储在数据库中。
当您将商品添加到购物车时,它们会被添加到数据库中的表格中,一旦您结帐,您的商品通常会添加到order_item表格中,订单表格中会显示您的订单信息,并且购物车已清空
我会检查控制器/模型文件以查看结帐代码的位置 - 肯定存在错误。