VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Virtuemart 1.1 Development (Archiv) => Quality & Testing VirtueMart 1.1.x => Topic started by: Alexander on October 03, 2009, 15:23:56 pm

Title: BUG: Ajax Minicart update breaks url to product
Post by: Alexander on October 03, 2009, 15:23:56 pm
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:

Code: [Select]
// 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:

Code: [Select]
// 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