how do i know where to send item bought on my websites - e-commerce

When a costumer buys something from a website how does the owner know where to send the items purchased and is there a way to get notification to my phone when a purchase is made from my website

when a user buy something on the website the owner will get the adress that the user had type in the fields -_- the HTML page will send with a POST the content of the fields to a PHP file on the server.
the form :
<form action="post.php">
First name:<br>
<input type="text" name="item" value="the item that you buy"><br>
Last name:<br>
<input type="text" name="adress" value="your adress"><br><br>
<input type="submit" value="Submit">
</form>
an example of the php file:
<?php
$item=$_POST['item'];
$user_adress=$_POST['adress'];
echo $item;
echo $user_adress;
?>
for the notification on your phone, you can create a page who display the information of a buy. but get a push notification on your phone will be more harder to do

Related

shopify app proxy: send customer data or only customer ID

I need to get customer first and last names and email address for the server side logic.
As I see it there are 2 options:
Form submit with the data in the body of the request to the proxied URL
GET request to the proxied URL with the customer ID in the URL, then using the shopify API to get all customer's info
I tend to use option #1 as it saves a call to Shopify, I will send the data over https.
How would you suggest doing so?
If you are submitting to a proxy form you should check out Gavin Ballard's post about validating the customer with a hash.
I do something similar where I respond to the app proxy get with application/liquid. See the reqHash field in the sample below. This processed through ejs whose tags don't conflict with liquid for any dynamic values:
e.g.
{% if customer %}
<input name="firstName" id="firstName" type="hidden" value="{{customer.first_name}}">
<input name="lastName" id="lastName" type="hidden" value="{{customer.last_name}}">
<input name="defaultAddr" type="hidden" value="{{ customer.default_address.id }}">
<input type="hidden" name="custid" value="{{customer.id}}">
<input type="hidden" name="reqHash" value="{{customer.id | append: '<%= custSecret %>' | md5}}">
<div class="form-group">
<label for="emailAddress">Email</label>
<input name="emailAddress" id="emailAddress" type="text" value="{{customer.email}}" placeholder="Email">
</div>
{% else %}
<div class="form-group">
<label for="firstName">Name</label>
<input name="firstName" id="firstName" type="text" value="" placeholder="First Name">
<input name="lastName" id="lastName" type="text" value="" placeholder="Last Name">
</div>
<div class="form-group">
<label for="emailAddress">Email</label>
<input name="emailAddress" id="emailAddress" type="text" value="" placeholder="Email">
</div>
<div class="form-group">
<label for="CreatePassword" class="hidden-label">Password</label>
<input type="password" name="customer[password]" id="CreatePassword" class="input-full" placeholder="Password">
</div>
{% endif %}
and then validate the reqHash when the form is posted.
Responding to a comment:
The question is what are you trying to keep secret from who. The customer already knows their info. Shopify maintains the session so they trust the info is associated with the correct id. SSL is a secure transport so the customer info is only clear in the browser. The hash lets the app be sure that the customer info is associated with the correct id. It’s the app’s way to verify the login. Otherwise a bad actor can send arbitrary info to the app. The poster who wrote they’d look up the customer info from the id still needs to verify the id so that they know they have the correct id of a valid logged in customer.
In fact since I wrote this 2016 I’ve started hashing all the info that I’m including in the hidden inputs.
The hash protects your app from hackers and bored script kiddies.
implies you will possibly receive garbage. The incoming data means nothing since a bot could fill in a form and submit.
at least implies you have an actual logged in customer. If you have the ID you also have the email and name, from Liquid. If your Proxy call is from a script tag that has no access like that, you can send the customer ID from the secret customer ID cookie value, and yes, make an API call. That is not a big deal at all.

i want to change url parameters

hi my url is something like this abc.domain.com/add/firstname/phone/email which is api link. i want to change parameters first name,phone,email when user enters in form. please let me know if anyone can help. thanks in advance.
add/?Client+Name=&Phone+number=&Email+ID=&Partner+ID=AUOVML i dont want url in this format. format must be as i mentioned in first line. i have done something like this:
<form method="get" action="http://abc.domain.com/add/">
<div class="d-nt-signup">
<div class="d-nt-field-wrap">
<input type="text" label="Name*" id="first_name" name="Client Name" active-color='#FB165B' class="d-nt-login-filed">
</div>
<div class="d-nt-field-wrap">
<input type="text" label="Mobile*" id="mobile" name="Phone number" active-color='#FB165B' class="d-nt-login-filed">
</div>
<div class="d-nt-field-wrap">
<input type="email" label="Email*" id="email ID" name="Email ID" active-color='#FB165B' class="d-nt-login-filed">
</div>
<div class="d-nt-field-wrap">
<input type="hidden" name="Partner ID" value="AUOVML">
</div>
When you do a get request with a form you will get the names and values of the form inputs added to the URL like that.
You can get around that by using a post request instead. Change method="get" to be method="post".
Developers will often handle the result of the form being sent with PHP. Change the action to point to a PHP file, and then in the PHP file you can access the form data through the $_post array like so $_POST["form_input_name"].
See http://php.net/manual/en/tutorial.forms.php for an example of echoing back data typed into a form.

Am trying to create an item in the cart for a Big Commerce store and it keeps redirecting to the item page I just left

We are working on behalf of a Big Commerce store owner and are trying to add items to the shopping cart by posting the same data that the regular item page posts, except it is done by an external program on another server. This is because we intercept the post (which is done via a postbackurl on an iframe included in the item page that allows the customer to customize the item)... and then repost the same data to the cart.
This was working in our test store but not in the client store. I'm wondering if the difference is that when the item page posts, the Origin header is of course from that store. WHen I post it from my program, the origin header is different. How can I tell what the real issue is?
Is there a setting in Big Commerce that allows posts from another origin?
Or, how do I add a store product from an external program into the Big Commerce cart?
Thanks,
Cindy
Yes, the product has options... I am not posting them in the form below but it makes sense that I should.
Here is a sample of my code:
<script type="text/javascript">
function submitform() {
document.forms["redirectpost"].submit();
}
</script>
</head>
<body onLoad="submitform();">
<form name="redirectpost" method="post" action="http://eystudios8.mybigcommerce.com/cart.php" enctype="multipart/form-data">
<input type="hidden" name="action" value="add">
<input type="hidden" name="product_id" value="211">
<input type="hidden" name="variation_id" vale="">
<input type="hidden" name="currency_id" value="">
<input type="hidden" name="qty[]" value="1">
<input type="hidden" name="ProductFields[1]" value="<?php echo $docsession; ?>">
<input type="submit" value="" style="display:none;">
</form>
I also have a configurable field I am attempting to post the docsession to.
Cindy
Adding this question:
I see that I need to post the options in my form - how do I know what field name to call each option? There are about 15 options I need to forward to the cart page. Cindy

Testing PayPal buttons

I generated a vb.net website to sell some quantity of a book. it's a vb.net site using a SQL server backend. I modeled the book's order form on the paper form the company was using. The form allows customers to specify: name, organization, address, city/state/zip, and quantity.
Once the form is complete, they submit the form to another page which records the form values in a database. I then have them press the add to cart button which is supposed to upload the cart information to paypal for checkout. For some reason the cart opens empty without any errors.
Here is my add to cart info:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="XXXXXX#XXX.XXX" />
<input type="hidden" name="item_number_1" value="2015" />
<input type="hidden" name="item_name_1" value="2015 Catholic Directory" />
<input type="hidden" name="amount_1" value="15.00" />
<input type="hidden" name="quantity_1" value="<%= Request.Form("add")%>" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="notify_url" value="http://10.5.0.43/catholicDirectory complete_order.aspx" />
<input type="hidden" name="no_shipping" value="2" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" style="width:120px; height:26px;" target="_self"/></center>
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
What I need to know is how do I:
Why is my cart opening empty?
Get PayPal to redirect back to my website so I can mark the transaction as paid by storing maybe a PayPal transaction ID in my database I researched this and was able to direct them back if they click a link to return, but I don't want them to have to click anything. Research directed me to seller settings in my account but can't find them to set auto return url.
You're going to want to use PayPal's IPN listener. There is an IPN simulator which you can use to make sure it's hitting your site correctly.
https://developer.paypal.com/webapps/developer/applications/ipn_simulator
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSetup/
You'll need to setup 2 accounts within sandbox. A personal and a business. The business account is where you send transations. You can use the personal account to login and test payments.
As for redirecting back after payment, you can set this in both your return URL and inside PayPal
<input type="hidden" name="return" value="https://yoursite.com/payment-success">
You can set auto return by following the directions here: http://wemakewebsites.com/blog/how-to-get-paypal-to-auto-return-to-your-website-after-a-customer-payment
EDIT:
<form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" >
<input id="element_1" name="amount" type="text" />
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="yourbusiness#email.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Payment">
<input type="hidden" name="return" value="http://yourwebsite.com/payment-success">
<input type="hidden" name="rm" value="1">
<input type="image" src="http://yourwebsite.com/images/btn-donate.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<input type="hidden" name="notify_url" value="http://yourwebsite.com/includes/paypal_ipn.aspx" />
</form>
Once payment is made the user will head over to PayPal to complete the payment. As long as you have the notify_url set with a working listener PayPal will hit it. In that file is where you want to put a few more db collections. PayPal can send you back a bunch of information (https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/) depending on what data you are looking for. In the following example (https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.vb) You'd want to add your db collection after line 35 where the user has completed payment:
If strResponse = "VERIFIED" Then
The idea was not to use an IPN listener (way more than I need), but rather to ask the customer how many books they wanted and add a single item to the PayPal cart: "# - 2015 Catholic Directory" where # is the quantity. The price for the book then becomes Quantity * $15. This way I can sell any quantity I want.
My database gets filled with customer information including quantity as a separate field when they fill out the order form and then that info gets sent on to PayPal to complete payment. Also I setup PayPal to auto return back to my site when the payment is complete and then mark the order as paid. This way I can develop reports for the office selling the books indicating who ordered how many books and if payment has been received.
Problem solved. The only thing I found difficult with the process was the fact that the sandbox environment does not have auto return like the live payment system does. I had to run a dummy sale for a penny and then refund the penny to verify the auto return was working.

Prestashop smarty make a form for user and save the input fields to the database?

In Prestashop I am doing a module. In that module I have view file(smarty template). In smarty I am doing form so that user can submit the form from frontend. Now when user makes fill the form and clicks on submit then the form should save all the vales to thae database. So for that in smarty I made a form like this
<div id="content" class="form-wrapper" >
<div class="form-content">
<input type="text" id="name" name="name" placeholder="Name" /> <br />
<input type="text" id="email" name="email" placeholder="email"/> <br />
<input type="text" id="phone" name="phone" placeholder="Phone Number"/> <br />
<input type="submit" name="submit-query" id="submit-enquiry" value="submit" />
</div>
</div>
and in the file where the values will be submitted I have made my code like this
<?php
include '../../../config/settings.inc.php';
include '../../../config/defines.inc.php';
include '../../../config/config.inc.php';
include(dirname(__FILE__).'/../../../../init.php');
if(Tools::getValue('submit-query')) {
$this->_html .=$this->displayConfirmation($this->l('Settings updated successfully'));
}
else {
$this->_html .= $this->displayError($this->l('You Have Some Errors'));
}
?>
Now when doing click on my submit button It is showing error like this
Fatal error: Using $this when not in object context in file.php on line 11
Now can someone kindly tell me what is the issue here and how can I make a form in smarty for frontend users so that they can submit the form and the value will be stored to the database. Any help and suggestions will be really appreciable. Thanks
First I would recommend to do the processing inside of your module, e.g. in init() function, you can get your module link using $this->context->link->getModuleLink('myModuleName'); and add it to the form action attribute, all variables can be assigned using $this->context->smarty->assign().
Storing values in database is quite a wide question. You have to provide some more details about it.
Check some tutorials from Prestashop e.g. Creating a Prestashop Module. You will find most of your answers there.