Use woocommerce with calculated quot from front end - php

I'm developing a website for a courier service, that has service quotation filling at the front end.
I did all form things working, a quotation will output variable with the cost of service in PHP.
After filling the form there will be checkout button, with that checkout button i need to save the details of the user, and that price to the woo commerce page to check-out/or fill further details. I searched throughout the google and got 1 solution to create a product with these values in front end. But its became very difficult to figuring out signing in, saving values, keep details in specific formate etc... for me as a beginner in PHP.
Can anyone help me with this?.
i just need woo commerce to make checkout with user entered details in the form.... .
EDIT & Updated :
Thanks for reply LoicTheAztec, I have gone through quick toure now
About code : I'm sending the values calculated in form to the page called buy-now using URL using javascript window.location.href=.
like http://example.com/buy-now?price=120&weight=80&location=000001
And also I'm able to fetch the value using
if (isset($wp_query->query_vars['pricef'])) in page template. (with StackOverflow help) and I'm checking user is logged in? using if(!is_user_logged_in()) and showing login form, After login also i can get the variables.
Now I need to create a transaction using this.
Saving data like a product or post and proceed for payment, I don't need to use woocommerce to do this but need some sort of idea to make it work.
Thank you.

Related

Woocommerce - Cart page - when cart gets renewed with new quantities, I want to be able to pass total

Ok - trying to slowly work my way through this - bear with me! Will try to describe what I'm doing here.
Using Woocommerce with theme called Flatsome - but this problem seems to relate to how Woocommerce updates the cart on the cart page.
So I am trying to bend Woocommerce to suit - so when client gets to Cart page - they do not move onto Checkout - instead I am giving them a Button to Request a Quotation - button when click opens a modal with a GravityForm in it.
I've been able to get the product list, quantities, price and SKU passed fine into the form ok using a 3rd party plugin ....
but boy oh boy - can I easily pass through the most recent TOTAL from woocommerce??
Not as easy as I'd hoped!
I had originally written this function into my functions.php
// Send the page url to parameter called 'gdcarttotal' for use in gravity forms
add_filter("gform_field_value_gdcarttotal", "populate_gd_carttotal");
function populate_gd_carttotal(){
global $woocommerce;
$totalamount = $woocommerce->cart->cart_contents_total;
return $totalamount;
}
And yes that seemed to pass through the Total of the Cart ok.
The problem arises if the quantities are updated whilst on that Cart page.
So if I update the quantity of a product - the totals etc all update fine on the Woocommerce cart page total BUT if I then click the launch Quotation form - the value for the Cart Total remains the value of the original total when user landed on that page. So it takes a full page refresh on the cart page to flush it and update it to the correct value.
Someone mentioned to me, Ajax which is beyond my capabilities.
Really just reaching out - and asking what is best way - or how could I write a function whilst on the cart page that will always give me the most updated TOTAL to pass through into a field on a form.
I've got a couple of screenshots but since my first time on here... I'm not sure if I can post or not. Hopefully this description tells the story.
Basically looking to know - whilst on the Woocommerce Cart page, how to pass the most recent TOTAL calculation to a form or page etc...
Thanks guys!!
Gareth
Your base issue is with the language you're using to solve the problem. You've written PHP, which is server-side (i.e., not real-time).
The WooCommerce cart is AJAX, a hybrid of JavaScript and XML, and it's processed client-side (i.e., in the browser) in real-time. That's how you are able to update the quantity and cart totals without a full page reload, and it's how the website is able to see how many items you have in the cart without reloading the page. Because of this, your solution needs to be client-side using JavaScript, I believe.
I'm not a pro developer, so I don't have the exact code to give you, but hopefully this gets you on the right track. You can also read more about AJAX here: https://www.w3schools.com/whatis/whatis_ajax.asp

Paypal with Contact Form 7

I have a problem contact form 7. I want payment with paypal combined contact form 7 . Picture :
Any suggestion for me?
Thanks.
There are several ways to solve this. You can either (a) redirect your submitted form to the paypal page on successful submission , or you could look at (b) building a paypal button on the fly when the form is being filled.
To implement solution (a) I would recommend your map your form to a custom using the Post My CF7 Form plugin. The plugin allows you to either hook into the submission process once the post is saved and integrate the paypal payment page (from PHP) using the saved fields, or you can also redirect to a confirmation page on your site with the amount to be paid and a paypal button. The advantage of saving your submission to a custom post means you can also save the paypal payment confirmation in the same post and keep a track of your payments.
For solution (b), just bind a 'change' event on your fields that affect the payment and build the paypal button url accordingly, see this answer as an example.
PS: If you wish to create a responsive grid-layout as shown in your screenshot, I would recommend the Smart Grid plugin extention to achieve a responsive grid layout that you have on your screenshot.

Customization for Payment Gateway in opencart

So I am trying to set up a site on my localhost. I have selected 2 payment gateways from admin end
Online Payment (Free Shipping)
Cash On Delivery(Free Shipping/Flat COD Charge INR 50 )
Now I have customized all the rules for them. I only need one more rule.
I wish to have a functionality wherein I can enter some pincode/postcode values (through admin panel or maybe in some array in a javascript file or directly into the database, does not matter) of locations where second method is available)
Whenever someone presses continue before confirming order, the checkout form is validated so as to check from the form data if the value entered in post code matches the data (from any of the above methods) and if yes, only then they can continue or I wish to show an error message that
Following payment gateway is not available in your location
If you give me a hint on how to proceed with this, perhaps, I might be able to take it further. I am a bit or a starter in opencart so not much idea about how to proceed. I have sound knowledge of PHP, JQuery and Javascript although. So any and all help will be appreciated.
There are a few different extensions that already exist to do what you want - allow you to restrict shipping methods by various criteria. This one is my personal favorite: http://www.opencart.com/index.php?route=extension/extension/info&extension_id=1614
I managed it with JQuery for the time being. Edited the submit function in the cart.tpl file in catalog->view->theme->ancart (theme name) ->cart folder.
Used a plugin called "Zipcode COD" to enter zipcodes. Edited the response JQuery to hide and show payment options.
Lots of hard coding but does the trick. I will post the code if someone needs.

Integrate Google checkout with Gravity Forms

I've created a multi step form using gravity forms that I want to integrate Google checkout with.
I have the following steps:
Submit user details.
Add media.
Payment (this is where the Google checkout step would go).
Thank you.
As far as I can see Gravity forms uses jQuery to show/hide each step so on step 3 is it possible to insert a Google buynow button (that has a set price) using jQuery?
It doesn't matter if it means the client needs to manually check if the submission is paid for (i.e check the submission against the payment).
All I want to happen is the user goes through steps 1 & 2, pays at step 3 and comes back to the thank you page
Gravity forms doesn't currently offer a Google Checkout add-on (it offers Paypal) but because the submission has a single price that doesn't change, I'm wondering if there's a way to incorporate it in?
I hope you have pagebreak element to have the 4 steps of forms. In the payment part (after the second pagebreak, you can use HTML element to add your Google Checkout button.

How to pass variables of each item through to paypals cart when selecting paypal's 'add to cart' button?

I am developing a website selling gardening products using PHP and SQL. The user searches for a plant, finds the one they want, clicks on it for more details and there they see an option to add to cart. I have signed up to Paypal's business account and used their add to cart button. But currently, when I try it out and click the button, it doesn't do anything. Obviously this is because know variables have been passed about that specific product. What do I need to do in order to get each item into the cart?
#QUESTION:
To impliment a normal POST to pass to standard form, follow this tutorial:
http://www.evoluted.net/thinktank/web-development/paypal-php-integration
#INTEGRATED SOLUTION:
Integrated solutions will allow you to make these transactions without going offsite.
Using this method requires alot more security.

Categories