Thanks in advance for your help. I'm completely stumped on how I can do this.
Here is my issue.
I have a node type show;
Each show has a number of performance dates and times.
When the user clicks "purchase tickets" from a show's page, I need to show them a single page, where the following happens:
The top of the page has a calendar that has dates and times available for this show highlighted. The user can then pick a date and time for this show that he wants to see. He can pick multiple dates and times.
Once he picks and date and time, I add them to a "cart" using ajax. The user can then enter the number of tickets that he wants for each performance.
Finally, on the bottom of the page he enters his checkout information (name, address, credit card etc) and is then pointed to a confirmation page. This is not done by ajax. Finally he authorizes the transaction and check out. (I'm using UberCart, but nothing else tied in, so I can switch if needed).
This is driving me nuts. I have no idea how to pull this off. Not even where to get started. Can someone please help?
What you want to do, is going to be quite hard and wont work well with ubercart, since you want to make a single add to cart and checkout page.
Ubercart will by default allow users to add items to their cart, and would also by default create a checkout flow, but you want something complete different than what ubercart offers. You might want to rethink your approach and either choose a flow that works better with ubercart or choose a different solution that by default works better with what you want (if there is such a thing).
What you can do
To do what you describe, you would need to create a custom page, that shows the calendar with the shows, some javascript to hand the ajax and a checkout form.
Behind the scenes you need to generate the calendar with the appropriate days (the date module might help you), respond to the ajax requests and add items to the basket, handle the checkout flow/order status and redirect to payment form or handle payment as well.
All of this would need to happen in a custom module, you would need to use hook_menu to create the page, that would take the product node as argument. You can use that in your callback function to generate the calendar. You would also need to create a callback for the ajax and add the actual javascript to do all the magic.
Related
I'm working on a site (reworking is probably a better word as I did not build it originally) and am encountering the following weird scenario:
Users go to a page which shows a list of current events. This is called "whats-on".
I have added a link to this page which takes users to a full event calendar for the month in a typical calendar format. This page is called "event-calendar". Once on the page they can also select which month they want to see and what type of events they are interested in.
Users can click on an event listed in any date to navigate to a page with the event details. (page is event-details with a query that pulls the relevant event.) I have added a back button to the page under the event listing which will return them to the calendar showing the month and search results they just looked at. No issues there - I am using PHP $_SERVER['HTTP_REFERER'] and that works perfectly.
Here is the issue - if I just did a back() or history.go(-1) link on that button, it takes the user all the way back to "whats-on". The same thing happens when you click the browser back button. It just skips over "event-calendar" entirely.
This apparently happens on the site under other scenarios such as business listings and searches.
Obviously I do not want that behavior - I want the back button to go to the previously viewed page like it should!!
I cannot think of anything in the code that would cause this, but the original site developers included a whole bunch of JQuery packages such as jQuery UI, and I'm wondering if something could be interfering with the default back button behavior. Is that even possible??
I guess what I want to know is there is any JQuery code that would change the behavior of the back button so I could hunt it down and kill it!!
Just looking for ideas as to where to start looking.
Apparently the only way I can get it to work is to manipulate the browser history using
history.pushState({}, '', 'event-calendar?<plus whatever query was used to pull the data>');
on the calendar page itself.
This seems to work but what a stupid workaround. Wish I could find the original problem.
I have a couple of pages where the user can add and remove stuff in order to update the results. i.e. in a "ShoppingList"-page where the user can add/remove drinks in order to see what ingredients they need.
Each of these drinks is stored in a cookie, with PHP, so the user have the ability to navigate and explore the site, and then return without having to add the drinks again...
When the user do this, adds/removes drinks, the entire page is reloaded.
Drinks are added to a cookie immediately, before any html and stuff, then refreshed once again in order to build the php.mysql.query based on the values now stored in the cookie.
I think this is a lot of unnecesary reloading and stuff. It should be something more like just refreshing the actual content that needs to change, and not reloading everything else - Lots of unnecesary mysql requests just to add/remove a drink from the shoppinglist. And this of course slows site down..
Whenever the page is loaded, I need to check the cookie in order to present the correct results. Then, when a user adds/removes a drink, I would like to do this in the background (update the cookie and update the result). Hopefylly this could speed up the user experience.
I have a site up'n'running here - as a "prototype" : http://barkeeper.thomaskile.me/?side=handleliste (norwegian site, but google translate sort of gives you an idea of what it says. just tested it..)
This same thing goes for all three pages on my site so far..
Any suggestion on how to accomplish this? Is it som sort of jquery.AJAX-thing? If so. WHere do I start any sort of ajax-thing. Not sure how that works in practice when the user doesn't do anything (on page load)...
This is usually done by manipulating DOM.
Remove the element from one list and create it in another list.
Checkout jQuery - the javascript library.
How can I add a form or HTML output to plgVmOnSelectPayment()?
I see no documentation about that.
I don't know this event Virtuemart payment select works.
I want add after selection a form with input fields.
Can anyone help ?
The plgVmOnSelectPayment() from what I've reversed engineered doesn't give any output to the HTML, but you can modify the cart content with that event.
I was myself in need of adding a form after a particular payment method was selected (to guarantee some additional data being supplied). Depending on where you want it you can either edit the View for the cart and add an if-statement where you see if the particular payment method is chosen. And then later access this information from plgVmConfirmedOrder() (you can access it through the $_POST global.
(This is an untested theory)
If you want to add the information to the field you can access the display form and add information there through the plgVmDisplayListFEPayment() event. Look in the vmPSPlugin class to see how they manage it there. What I did was simply copy that to get an image into that form, but you should be able to add other things there as well. And then you might be able to access the information there through plgVmOnSelectPayment() and using the $_POST global.
As a fair warning. All this I've gotten through reverse engineering VirtueMart. So it's neither pictue perfect nor might it be best practice. But the VirtueMart documentation leave not many other options :(. So if someone have a better way, I'm very interested in knowing that as well!
the question seems a litle bit strange, but I wonder if there's an easy solution to hide the add to cart button cause I would like to display a showroom of the products without anything, the add to cart button will only appears after an user event (select a store in a module in that case)
any good tricks to realize that ?
For now I'm thinking a session boolean variable set if the user has check which store he'll be linked to, perhaps there's something better ?
Thx
I am intrigued now as to how this is going to look! As mentioned earlier you can have your store selection stored as a cookie to give some persistence, in that way the site visitor can think and reflect about a purchase and not go through hoops next time they sign in.
If the cookie is not present you could put this in the end of your template to hide the buttons:
if(getCookie('yourstorecookie')==NULL) $$('.add-to-cart').setStyle({display:'none'});
noob question: I'm building a checkout system for an online commerce site. I'm getting the bug where clicking on the "place order" button multiple times will place the order multiple times. I have an idea to load between the button-click page and place-order page with a page that waits several seconds before launching using javascript the place-order page.
My question is: what are some of the policies online for dealing with this particular scenario?
The recommended practice is to:
Include a unique id on the order page
Disable the order button once it has been clicked
Check for the unique id in your serverside processing (make sure to handle race conditions)
There are lots of specific details to consider, but these heavily depend on your platform/framework of choice.