Guest paulabakerparkin Posted November 21, 2005 Share Posted November 21, 2005 Hello, I am losing sales due to customers not noticing that when they clicked 'add to basket' the product has actually added to the basket. Is there a way to have it that when the customer click 'add to basket' they are automatically sent to the 'view cart' page? I know that it updates in the shopping cart box, but my customers aren't figuring it out! Can anybody help me...I will pay if needs be! Paula Quote Link to comment Share on other sites More sharing options...
Guest paulabakerparkin Posted November 24, 2005 Share Posted November 24, 2005 bumb Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 24, 2005 Share Posted November 24, 2005 ----------------------------------------------------------- We interrupt this thread to make the following public service announcement: SOLUTION POSTED HERE Thanks, Estelle! Carry On! ----------------------------------------------------------- Hi Paula, That link is controlled by javascript in your_skin_file/styleTemplates/content/viewCat.tpl, so it should be very simple matter to do what you ask. Open the file, and look for the comment <!-- BEGIN: buy_btn --> (around line 38 in Classic skin). There are a couple of lines of code between that comment and this closing comment, <!-- END: buy_btn --> containing a link that looks like this: href="java script:submitDoc('prod{PRODUCT_ID}');" AFTER the semi-colon, and BEFORE the double-quote, add this: [Edit: This code has now been corrected for an errant colon] location='cart.php?act={CART_STEP}'; so it now looks like this: href="java script:submitDoc('prod{PRODUCT_ID}');location='cart.php?act={CART_STEP}';" That's it. :w00t: Quote Link to comment Share on other sites More sharing options...
Guest paulabakerparkin Posted November 24, 2005 Share Posted November 24, 2005 Thank you for your reply...but it doesn't seem to work. The page is stilljust refreshing! have a look: http://www.prettypebbles.co.uk/pbstore1/in...od&productId=36 Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 24, 2005 Share Posted November 24, 2005 Paula, thanks for the link. Evidently, though, you moved the javascript snippet that I gave you back out of the file by the time I saw your page. When I view the source, the code that I gave you isn't there; furthermore, I find two "Add to Basket" buttons on your page. #1 <p align="right"><a href="java script:submitDoc('addtobasket');"><font color="#333333"><img height="44" alt="" src="http://www.prettypebbles.co.uk/pbstore1/images/uploads/abbutton.gif" width="90" border="0"/></font></a></p> #2 <a href="java script:submitDoc('addtobasket');" class="txtButton">Add to Basket</a></span></span></p></td> But the main reason that my code didn't work properly is that I mistyped it - I used a colon where I should have used an equal sign should be location= not location: Try making your javascript look like this in both instances: href="java script:submitDoc('addtobasket');location='cart.php?act=cart';" I'm sorry about the earlier mistake; this should work for you. If it doesn't, and you want me to actually work on and fix the problem for you, I will give you a 50% discount on the services required B) Quote Link to comment Share on other sites More sharing options...
Guest revolvere Posted November 24, 2005 Share Posted November 24, 2005 I was just about to ask this very same question. Unfortunately I've done as you suggested Mark and still doesn't seem to take the customer to the cart page. If it helps you can view my page http://slogmeat.com/shop/index.php?act=viewProd&productId=1 where I have done it. You'll have to ignore the layout for now it's still in it's construction stages. Quote Link to comment Share on other sites More sharing options...
Guest aikdo Posted November 25, 2005 Share Posted November 25, 2005 Of subject and in reply to the last post nice skin... I would like to add that i am being redirected to the cart, the first time however i was taken to an empty cart and the second time i was taken to the cart as intended with the item in... Dont understand this fully... But AGAIN Very nice store... Quote Link to comment Share on other sites More sharing options...
Guest aikdo Posted November 25, 2005 Share Posted November 25, 2005 Marks i would like to ask why you made a second alteration to the code you suplied... First href="javascript:submitDoc('prod{PRODUCT_ID}');location:'cart.php?act={CART_STEP}';" then you said to change the : to an = but your second code was href="javascript:submitDoc('addtobasket');location='cart.php?act=cart';" Why did you use {CART_STEP} in the first snip and cart in the second? is it ment to be href="javascript:submitDoc('prod{PRODUCT_ID}');location='cart.php?act={CART_STEP}';" ??????????? Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 25, 2005 Share Posted November 25, 2005 Thanks for catching that - I didn't really think it should matter. "cart.php?act=cart" should take you to the cart alright, "cart.php?act={CART_STEP}" also takes you to the cart, but includes a variable that is meant to tell the cart which step of the checkout process you're on. The link with the variable is the link that appears in styleTemplates/boxes/shoppingCart.tpl, and the other (act=cart) is the same link that appears elsewhere on the page that Paula was coding. Evidently the javascript worked as expected in sending the viewer to the cart, but the submitDoc() function is not working properly in tandem with it. For this, I do not have a ready answer EDIT: I'm curious now, I'm going to experiment with this on a test store to see if I can find a solution. Meantime, I'd suggest that no one else should institute the code before I get it working . . . Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 25, 2005 Share Posted November 25, 2005 OK, I've gone round and round and tried every way I can think of to make these methods work simultaneously on the onClick or href event with javascript . . . and I finally go it working, but it is only through a cludgy workaround. I had to throw an alert method between the submitDoc and location methods. I couldn't find a way to make it work without doing this. Good news is your customers will definitely know they've successfully added products. Bad news is that if your customers add quite alot of products, they will surely find the alerts annoying. To see this at work at my test site, go here and add products to the cart: http://allservico.com/skinTest/ If you really want this code, here it is; I added this to viewProd.tpl at the add to basket button . . . <a href="javascript:submitDoc('addtobasket'); alert('This product will be added to your shopping cart.'); location('cart.php?act=cart')" class="txtButton">{BTN_ADDBASKET}</a> Enjoy ;) Quote Link to comment Share on other sites More sharing options...
Guest vrakas Posted November 25, 2005 Share Posted November 25, 2005 Its a good solution and i like it You only need to insert this code and thats it? :huh: Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 25, 2005 Share Posted November 25, 2005 At the "add to basket" button code, there is this link: <a href="javascript:submitDoc('addtobasket');" class="txtButton">{BTN_ADDBASKET}</a> REPLACE with: <a href="javascript:submitDoc('addtobasket'); alert('This product will be added to your shopping cart.'); location('cart.php?act=cart')" class="txtButton">{BTN_ADDBASKET}</a> Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 25, 2005 Share Posted November 25, 2005 BAD NEWS - Doesn't appear to work in Mozilla still Here's what I get with FF and ns, item is added and alert pops up, but you do not get sent to cart. Sorry though, I can't work on this any more for awhile as I have a couple of commissions to work on. Perhaps a more knowledgeable scripter can fix what I could only rig up half-arse :huh: Quote Link to comment Share on other sites More sharing options...
Guest Posted November 25, 2005 Share Posted November 25, 2005 So to clarify can you explain wot we have here and what we want pls? If we just add this code last post it pops a alert window up or takes u straight to cart? Quote Link to comment Share on other sites More sharing options...
Guest paulabakerparkin Posted November 25, 2005 Share Posted November 25, 2005 Thank you for all you help! I've used this as a fix for now, as it does the job and my client is happy! Quote Link to comment Share on other sites More sharing options...
Guest Posted November 25, 2005 Share Posted November 25, 2005 Could you post the site you have this on pls so I can see what it does exactly. Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 25, 2005 Share Posted November 25, 2005 @evilhomer - Reading 101 Read the whole thread and maybe you'll understand . . . look also at her site and you will see why customers need assurance that items are actually added when they click "Add to Basket." My problems getting both location() and submitDoc() to work simultaneously on clicking the "Add to Basket" should be pretty clear above. What I finally did was add an alert between those two methods. The alert is annoying to me, but it makes the script work in IE, item is added and customer is taken to shopping cart. In Mozilla, customer is not taken to cart but item is added and an alert is given. Best I can do for now, but if you have an answer, what she wants is simply for visitor to be sent to cart and item added to cart when "Add to Basket" button is clicked :huh: Quote Link to comment Share on other sites More sharing options...
markscarts Posted November 25, 2005 Share Posted November 25, 2005 Just saw your last post . . . all this is in the thread above, but here are some links: Test site where I have the script running: http://allservico.com/skinTest Paula's site: http://www.prettypebbles.co.uk/pbstore1/ Quote Link to comment Share on other sites More sharing options...
Guest estelle Posted November 25, 2005 Share Posted November 25, 2005 Okay... this is much easier if you go about it a different way... Solution shown here (Where possible use PHP rather than javascript ) Estelle. Quote Link to comment Share on other sites More sharing options...
roban Posted November 25, 2005 Share Posted November 25, 2005 I get this with estelle's mod Warning: Cannot modify header information - headers already sent by (output started at /home/vitaminl/public_html/includes/content/viewProd.inc.php:221) in /home/vitaminl/public_html/includes/boxes/shoppingCart.inc.php on line 83 Quote Link to comment Share on other sites More sharing options...
Guest estelle Posted November 25, 2005 Share Posted November 25, 2005 Try adding an exit below each of the two header("location:...") commands. I.e: exit; Quote Link to comment Share on other sites More sharing options...
roban Posted November 25, 2005 Share Posted November 25, 2005 Thanks estelle. Still doesn't do it. I'll stick with the pop up 'added to cart' string. Quote Link to comment Share on other sites More sharing options...
Guest estelle Posted November 25, 2005 Share Posted November 25, 2005 Okay, I'm thinking you must have some whitespace after the closing ?> at the end of viewProd.inc.php. Remove that and it should work. (Sorry about your problems with emailing me - Gmail only recently started rejecting particular zip files, argh) Estelle. Quote Link to comment Share on other sites More sharing options...
roban Posted November 25, 2005 Share Posted November 25, 2005 Quite right estelle. I had white space, removed it and all is well. Thanks for hanging in there! Quote Link to comment Share on other sites More sharing options...
Guest estelle Posted November 25, 2005 Share Posted November 25, 2005 No worries ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.