Create a simple shopping cart in wordpress? - php

I have a wordpress website, and I want to create a simple web commerce. When I mean simple, it's really simple: Some posts/pages are going to have a custom field named "price". These pages are going to have a link on it, and clicking on it, the user is going to be sent to a simple shopping cart. From the shopping cart, I'm going to create a checkout page, which is mainly a php page that connects to a payment gateway, showing credit cards and such. I'm going to create php files that validates info about these payments after the response from the gateway.
I'm not going to sell "products". I don't need postal offices, no address to deliver something, nothing. It's just a price and a php that receives confirmation from the payment gateway. Think of selling "courses" or something like that. A receipt of the buy is going to be in the database, so the client can reference it later.
So, I think I need to create:
A shopping cart page. This shopping cart can be made using cookies or the database. Which is the best approach?;
A checkout page;
A bunch of scripts to validate a response from the payment gateway;
A simple table that stores all the payments responses, containig price, user_id and such.
Am I forgetting something? What else should I be aware of when trying to create this plugin? I heard that wordpress don't use sessions, so I would need to create one in wordpress just for the carts. Does anyone knows about this issue?
(I don't want to use these complete e-commerce plugins that exist since I don't need all their features.)

I decided to use a cookie approach using $_COOKIE. The values in that cookie are a json_encoded associative array with product information, that is checked in the server with some validation. That way I don't have to mess up with $_SESSION in wordpress that I read is problematic, and the user can have the same shopping cart even if (s)he closes the browser.
One good example of simple e-commerce application is really simple e-commerce.

Just an option, if you are wanting a simple shopping cart (with PayPal integration) and are not wanting to reinvent the wheel, check out Simplecart JS. A javascript, persistent, shopping cart which allows your users to collect items and then proceed to the PayPal portal to complete the purchase.

An easy way to setup an online store is by using the Market theme.
Market is a theme template for Wordpress, that contains a built-in shopping cart system, and product administration tool for easily adding and editing products.
It connects with your Paypal account for processing your customer payments.
If you want to, you can play around with an online demo here:
http://www.markettheme.com/
That way you can try it out before you commit to anything.

Related

implement multiple payment gateways in codeigniter checkout?

Can Any one suggest me how to implement multiple payment gateways in a single cart page in codeigniter. i would like to implement bit pay, go card less, and pay pal, i don't know how implement this any ideas???
and any implementation techniques also useful for my development. i have seen this kind of implementation in word press.
enter image description here
You will need to create a different Library for each provider - potentially storing files in the third_party folder (and referencing with APPPATH). You can then load whichever library you need depending on the choice. See : https://www.codeigniter.com/user_guide/general/creating_libraries.html
You will need to add one button in cart page like "Check Out", after clicking this button give or show multiple payment options to customer like PayPal, Credit Card etc in other page.
And than system identify which button pressed by customer or user.Also you will need to create different library for all payment options.

Send cart and user to another website to complete checkout process

One of my client runs a successful store using WooCommerce, and now he wishes to create another WooCommerce site with the exact same products. But since opening a new actual business is a big deal for him, he wish that after the users has placed items in their cart and clicked on "checkout", the user will be redirected to the first ("original") site and choose the shipping option and payment method and complete the checkout process there.
We have thought about it through, from different aspects, and finally the user insist this is the solution he wants to try.
Can it be done? If yes, does anyone know of a simple way to accomplish it? or what should I consider before trying to implement this solution.

receive payments with paypal

I'm creating a really small website where I'll sell some products.
I need this website to show the available products, the users can add to the cart, and pay at the end, then I'll send the product for them by my self. It's a really small business.
I was taking a look at the paypal options and I didn't understand very well how it works.
For what I understand, with a free account I can only use their buttons, but I can't have a dynamic solution where I can manage my products on my website (look's like I need to add the products information like name and price on their website ).
What I wanted to do was just use my own website to handle this very simple store/products, and at the end, the user click on a CheckOut button, and Then I redirect the user to a paypal page where they can pay for the total value and then paypal redirect them back to me ( as a free account or at least with the 5$ account ).
Is that possible?
By the way I'm using CakePHP to build that, and I already have the website built with this framework, and to build what I need it's more than enough, I don't really need any solution like magento or others eCommerce platform.
Thank you.
If you use Paypal's free account then your visitor will leave your website, go to Paypal's website to make the payment, and then return to your website. Paypals paid version allows you to keep your visitor on your page, but you have to program you site to work with their API. Plus the cost can add up. Paypal also has other service other than just buttons. For instance they have a shopping cart too, but here again your vistor will leave your website to go to Paypals site to add the items to the shopping cart.
Another company that you might want to look at is https://stripe.com/ here you keep the vistor on your site as well as only paying per transaction rather than a monthly fee like at Paypal.
If you want to manage your items and inventory from your website and not enter everything into buttons at PayPal.com, I would suggest that you use Express Checkout. Express Checkout is also a free service and allows you to send all of the payments details to PayPal via API and PayPal will authenticate and allow your buyers to select shipping details. The user can then be redirected back to your website to complete their order.
You can find additional information here: https://www.x.com/developers/paypal/documentation-tools/express-checkout/gs_expresscheckout
Thanks,

Passing variable values over to paypal's cart for payment

I have created a basket where a user can add to and update etc. This basket has been built based on what product the user adds to cart obviously. The product itself is grabbed from the database and displayed in a table in the basket. How do I use Paypal from here? I now want a button called 'pay' that the user can click and then it takes them to Paypal to pay. But I want the details of the items to be displayed in Paypal.
I have signed up to paypals web standard payment. Obviously I don't need their add to cart buttons since I have got my own cart. I think I just need the buy button but as mentioned, I am not sure how to get products over to Paypal.
Can somebody explain what I need to do please
This broad of a topic is generally best suited with a quick Google search. Basically, find a paypal form (perhaps through Paypal's button builder) and edit the form's values to suit your needs. This can be accomplished with php or javascript quite easily (PHP is a bit safer as it limits tampering). Then users send the form :)
You can also create a link such ashttps://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$business which will do the same as the full form (add all of the fields you want to send, of course).
Give it a shot - if you have more specific questions, post back with clarifications.

Custom VirtueMart Options

I'm working on a project that ties into an API and uses virtuemart. Basically a user can buy time for a phone card. the few things I need help with are:
A) can/how can I create a custom php function once the user signs up. For instance, the user adds Items to the cart and proceeds to checkout. once the user clicks checkout they need to create an account, after they create an account is there an area in this process that allows for a custom function so that I can tie the creation of the account to an API?
B) same as above but after checkout. After the checkout goes through, how can I make it so the new values are sent to the API? Is there an area in the files that allow for custom functions here.
C) Lastly is it possible to add more options the the virtuemart customer account maintnance screen. I want an option that will tie into the API and show them exactly how much time the have left for their phone card. This information will be provided by the api.
All of these things can be achieved with a System Plugin. You would simply look for the right url, get any information from the result screen with regex, call your API and insert any changes back into the screen.
I'm not specifically aware of any VM functions for this, but as VM is in flux with Version 2 getting closer, it may not be a good time for any such investment in any case.

Categories