News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

BUG: Ajax Minicart update breaks url to product

Started by Alexander, October 03, 2009, 15:23:56 PM

Previous topic - Next topic

Alexander

Hi buddys,

I tried to setup a bug in the tracker but I just don't see how that works so I post it here. If you add a product into the cart and the ajax update function replaces the minicart contents you will get wrong URL's pointing to index2.php instead of index.php. Fixing it is easy, in shop.basket_short.php you just have to replace the following:

// Build URL based on whether item or product
if ($product_parent_id) {
$url = $sess->url(URL . basename($_SERVER['PHP_SELF'])."?page=shop.product_details&flypage=$flypage&product_id=$product_parent_id&category_id=$category_id");
}
else {
$url = $sess->url(URL . basename($_SERVER['PHP_SELF'])."?page=shop.product_details&flypage=$flypage&product_id=" . $_SESSION['cart'][$i]["product_id"]."&category_id=$category_id");
}


with this:

// Build URL based on whether item or product
if ($product_parent_id) {
$url = $sess->url(URL . "index.php?option=com_virtuemart&page=shop.product_details&flypage=$flypage&product_id=$product_parent_id&category_id=$category_id");
}
else {
$url = $sess->url(URL . "index.php?option=com_virtuemart&page=shop.product_details&flypage=$flypage&product_id=" . $_SESSION['cart'][$i]["product_id"]."&category_id=$category_id");
}


The problem is that the $_SERVER["PHP_SELF"] var will always point to index2.php at this point as the ajax scripts call on that file and not on standard index.php