Jump to content


Photo

Location Question


  • Please log in to reply
1 reply to this topic

#1 laide234

laide234
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 11 August 2006 - 02:41 AM

I'm a newbie, so this could be really simple...

I have an onClick event attached to my "Add To Cart" button that adds a product to a shopping cart.

onClick="window.location.href='<?php echo $cart_url; ?>';"

where $cart_url is cart.php?action=add&p=72

I would also like, when the item has been added to the cart, to go to the parent category page of that item.
i.e. when you add a basketball to the cart (from index.php?c=300&p=72) it goes to to the list of sporting goods page (index.php?c=300)

onClick="window.location.href='<?php echo $_SERVER['PHP_SELF'] . "?c=" . $catId; ?>';"


...How can I have that one button accopmlish both these tasks?? Please help.

#2 bltesar

bltesar
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 11 August 2006 - 02:57 AM

to your first onClick event handler
        onClick="window.location.href='<?php echo $cart_url; ?>';"

add ?c=300.

Then set up your cart.php page to direct to the index.php?c=whatever page





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users