submit form data to custom page for emailing - shopify

I created a custom form on a shopify page and when the submit button is pressed i want all the data within the form fields to go to another page that is a request form where the user would enter data and upon submission the data will be emailed instead of buying anything. How is this done in shopify? the page that i'm talking about is this one
https://pharaohmfg.com/collections/billiard-pool-tables/products/luxor-pool-table

You can redirect to another page with a custom form but the email will not be send since you are required to use /contact#contact_form as the form action.
One way to bypass that is to submit the form as a contact form and redirect the user upon form success. Please note that this way if you submit the form more than once you will get a google challenge for spam protection which is not user friendly.
Another way is to create a custom APP and using a proxy to submit to that page and handle the request from there.
Or an another option is to use a third party app of some sort and use their form builder ( hopefully allowing you to tie the product variants in some way to the actual form ).
There are free services like formspree that allows direct submissions to an email but I don't know what are the limits there.

Related

Net Core 6 - posting between razor pages

Is there a way to post between razor pages without disabling the Anti-forgery Token? I appreciate that sounds stupid, but what I'd like the user to be able to do is submit a mini version of the contact us form on one page and the submit action takes them to a different razor page where they can continue to fill in the rest of the form. It's essentially so we can include a mini contact us form in the footer of all pages as a view component. The view component can't handle the post because there is no endpoint for the view component. Whereas this could probably be achieved by carrying the form data on the query string, that then exposes their name/email data which is undesirable. Adding the [IgnoreAntiforgeryToken] attribute on the contact us page works, but is there a way to make it work without removing the validation/checks?

Separating redirection logic in angular pages

In my application we have a summary page having a link to take the user to the different pages of the application. For example, we have separate pages for collecting personal details, address details, education details etc., and there is a summary page giving the summary of a student's data. Users of the application will go to the summary page and then navigate to any individual pages in case if the data is not filled up yet. After the user goes to the individual page, they can enter the required details, and upon saving the entered details, they will be eventually redirected back to the summary page.
I have implemented the above functionality as below at the moment,
When the user clicks on a link to the address details page from the summary page, I will pass the redirect url as a query string to the summary page, and upon the user saves the address details in the address page, I will redirect the user back to the summary page using the redirect url passed on the query string.
Each individual pages have a common base class
Redirection logic is present in each individual pages now. This logic checks if there was a redirection url present in the query string, then if present it will direct the user to the summary page after the user clicks on the save button on the current page.
I feel the above solution is elementary, there is potential for adding new pages to our application.
I wonder if there is anyway to implement the above requirement in a elegant way in such a way that the redirection logic is separated as a angular service, route or any other angular technique so that we dont have to do any thing extra for the new pages that will be added in the future.

Laravel tests from the website

I am looking for a way to make test cases that can be added to the admin dashboard of a laravel website. For example if a page on the website does contain a form to submit to the database in the dashboard the form can be tested for errors and even submission speed and if the form is collecting the right type of data integer field and string fields.
I click of a button and the forms and content will be tested.
I would really like to know how I can setup something like this but not really sure what to search for, any links are welcome to a website or message.
Best regards

How do I connect my appixia app to my prestashop contact page?

I've added a contact button on the title bar but I can't get my contact form to display. Has anyone done this?
First of all, the contact button Module field should point to a new Activity module like VerticalContainerActivity which should contain an HtmlView module in its body. This HtmlView displays your contact page - put the address in its ContentUrl. Most of these steps are identical to what you'll find in this tutorial.
You can see an example of this in the diamonds sample app. Create a new app from the diamond store starting point and see how the contact button is implemented there.
The second important point to remember is that you shouldn't use regular store URLs in your Appixia app. When the user sees them, they would see your Prestashop theme with all the navigation and this will be very confusing inside a mobile app. Instead, make a mobile friendly version of your contact page which doesn't use your Prestashop theme and only shows the contact info content.
Using the Prestashop Contact Form in your Appixia app:
I'm not sure this is a 100% good idea in terms of usability. I don't recommend using a web form for contact in a mobile app.
A mobile phone is a communication device. It is has special integration for making phone calls and sending emails - I really recommend you use these methods instead. Look at the HTML source of this example to see how simple it is to integrate (it's just a link in your HTML).
In order to encourage your users to contact, you need to ask them for as little info as possible. Your website contact form makes your users type in their email address. If they email you directly through their device (with a mailto: link), their correct email will be filled automatically. Same with making a call, when they tap on the link, the number will be dialed automatically for them.
If you really insist on implementing the Prestashop contact form, this will require some Prestashop php games. You should find the contact form controller in the Prestashop source and create the same form (in php or hardcoded HTML) without your website theme. It will be a little annoying because after we submit the form, we also need to make sure the confirmation message is also displayed without your website theme.

PrestaShop - Reload CMS page with additional parameters

Situation: I needed to add form with POST method to CMS page. I created custom hook and a module displaying the form successfully. Then I need to react to user input errors eg. when user doesn't enter email address I need to detect it, display the whole page again together with the form and with "errors" in user input clearly stated.
Problem: The problem is to display the WHOLE page again with connected information (eg. about errors etc.). In the module PHP file when I add this kind of code,
return $this->display(__FILE__, 'modulename.tpl');
it (naturally) displays ONLY the form, not the whole CMS page with the form.
In case of this code,
Tools::redirectLink('cms.php?id_cms=7');
I can't get to transfer any information by GET neither POST method.
$_POST['test'] = 1;
Tools::redirectLink('cms.php?id_cms=7&test');
I tried to assign to smarty variables too
$smarty->assign('test', '1');
(I need to use it in .tpl file where the form itself is created) but no way to get it work.
{if isset($test)}...,
{if isset($smarty.post.test)}...,
{if isset($_POST['test'])}... {* neither of these conditionals end up as true *}
Even assigning a GET parameter to url has no impact, because there is link rewriting to some kind of friendly url I guess, no matter I included other argument or not. ([SHOPNAME]/cms.php?id_cms=7&test -> [SHOPNAME]/content/7-cmspage-name)
My question is: is there a way to "redirect" or "reload" current page (or possibly any page generally) in prestashop together with my own data included?
I kind of explained the whole case so I'm open to hear a better overall solution than my (maybe I'm thinking about the case in a wrong way at all). This would be other possible answer.
The simplest method would be to use javascript to validate the form - you can use jQuery to highlight the fields that are in error; providing visual feedback on how the submission failed. In effect you don't allow the user to submit the form (and thus leave the page) until you're happy that the action will succeed. I assume that you will then redirect to another page once a successful submission has been received.
There's lots of articles and how-tos available for using javascript, and indeed jQuery for form validation. If you want to keep the site lean and mean, then you can provide an override for the CMS controller and only enqueue the script for the specific page(s) you want to use form validation on.
If the validation is complex, then you might be best using AJAX and just reloading the form section of your page via a call to your module. Hooks aren't great for this kind of thing, so you might want to consider using an alternative mnethod to inject your code onto the cms page. I've written a few articles on this alternative approach which can be found on my prestashop blog