You are here: Re: add item to shopping cart problem « PHP Programming Language « IT news, forums, messages
Re: add item to shopping cart problem

Posted by Tony on 07/20/05 22:15

R. Rajesh Jeba Anbiah wrote:
> Josef Bl�sl wrote:
>> hi folks!
>>
>> i have a cart link in all of my listed products on the site. when i
>> press this link i will generate a url like this
>>
>> http://www.mysite.com/index.htm?location=shop&view=cart&action=addtocart&productid=3
>>
>> after i press this link the site cart.php will be included and add
>> the wanted product to the cart, and show the cart.
>>
>> my problem now is after the cart is showed with the new product in
>> it, when i press the F5 key in the browser to refresh the site, the
>> same product will added to the cart once more, because the previous
>> generated url is unchanged in the browser.
>>
>> have anyone a idea how to fix this problem?
>
> This is not acutally a problem. Moreover it's a usability feature.
> If it's get added, the enduser may delete it.

Actually, it's easily solvable. You have two scripts - let's call them
additem.php and showcart.php

when you add an item to the cart, it calls additem.php, which does the
actual work of putting the item in the cart. But it doesn't output anything.
When it's done processing the added item, additem.php uses header() to call
showcart.php, which displays the cart. If you hit refresh at this point,
you're only refreshing showcart.php, and not processing the added item
again.

--
Tony Garcia
Web Right! Development
Riverside, CA
www.WebRightDevelopment.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация