Shopify: How to add user as subscriber from contact form? - shopify

I have tried searching but so far haven't been able to find a solution that doesn't involve paying for an app or using a third party form. So if anyone has a solution to this I'd be so happy.
I need to include a checkbox on the standard contact form on a contact page page.contact.liquid. I understand how to add fields, but I want the checkbox, when checked to automatically add the user to our subscriber list.
I have tried adding the below, hidden field, but it doesn't add a subscriber. It doesn't seem to do anything.
<input type="hidden" name="customer[accepts_marketing]" id="hiddenMarketingCheck" autocorrect="off" value="true" >
I did look at the code in the subscriber form section and noticed that the two forms are tagged differently using form_type. So I did some testing and changed the form type from contact to customer. So basically the output goes from this <input type="hidden" name="form_type" value="contact"> to this <input type="hidden" name="form_type" value="customer">.
That 'half works', because it does achieve my original goal to add a user to the 'customer accepts_marketing'. But then it doesn't send the message to the admin user of the site. So now it doesn't work as a contact form.
Does anybody know how I can achieve this? Maybe there are other form types I can use? Or additional fields I need to add?
Any help will be much appreciated.
Many thanks in advance.

My suggestion would be not to add the users at this stage, however, what I did on one of my projects was to put the subscription field AFTER they submitted the contact form and on the success message box.
This way you give them a clear option and understanding that they are subscribing with you and you didn't force them to do so.
I had a much higher acceptance than simply opting in the user.

Related

The manual discount input not working on Shopify cart page

I need a coupon code input on my cart page but it doesn't seem to work in its plain form:
<input type="hidden" name="discount" value="{{ settings.modal_promo_code }}" >
I have it right before the submit button, inside the form.
Live coupons are not being applied to the order on the checkout page.
Is there anything else I need to do for it to work?
Edit: The form looks like this —
<form action="/cart" method="post" class="cart">
<input type="hidden" name="discount" value="{{ settings.modal_promo_code }}" >
And it redirects to a URL like this:
https://store.com/4934605xxxx/checkouts/04d6478feeb9d3262fbea5571b682ebc?_ga=2.260083023.358228188.1608464294-110675315.1604953057
it seems there is a conflict that doesn't let the discount apply to the URL or get removed by ?_ga=2.260083023.358228188.1608464294-110675315.1604953057 because when disabling the JS in the chrome setting and submitting the checkout again it works and the discount is getting applied.
any thoughts on this? how can I get this working like this:
https://store.com/4934605xxxx/checkouts/04d6478feeb9d3262fbea5571b682ebc?_ga=2.260083023.358228188.1608464294-110675315.1604953057&discount=TBSRWDVS
thank you
As long as your cart isn't utilizing AJAX to upgrade and divert this ought to work.
The checkout page acknowledges a get contention of ?rebate= and including a field with a name="discount" will include that contention to the checkout.
This works as it were in the event that you yield the standard shape specifically. (in the event that you overhaul the cart, the field rebate content will not be present and you wish to re-enter it again) If you must overhaul the shape you may get to keep the markdown code in a few ways, through overhauling the cart with ajax or putting away it as a cookie.
So your code ought to be working, I twofold-checked it on my dev store and there are no issues, it applies a rebate to the checkout page since the get contention is present.
PS: This does not include a rebate to the cart question, it is as it permitted for the checkout divert to incorporate a get contention, nothing else. So usually comparable to making an interface with
Checkout
A late response, but want to answer your questions and share a solution for this.
First off no you cannot apply a discount code to cart the way you discribed, it is possible and doable but a bit more complicated than ading an input field to a form.
There is no OOTB Shopify solution for this, but there is some undocumented API endpoints that can be used to create this feature.
Check out Shopify Discounter Web Component, it supports:
Discount codes
Automatic discounts
Gift cards
Discount combinations
Multi currencies
Internalization
Style customization using css variables
Place it anywhere in your store
Hope this helps.

My HTML page does not upload at the top of the page

I am just in my first year of a computing degree. I am looking for a job, unfortunately I have to go back to accounts as nobody is keen to hire someone after just one year of computing studies, with almost zero experience. However, I thought to make it interesting and create an online Curriculum Vitae, as my job history is all over the place and it's a lot harder to keep in on a 2 page word doc.
What I have done so far, it's here: http://lavinia.gear.host/
Just a simple site, using Bootstrap (as I was curious to try it), minimal JS, HTML and CCS.
As you notice, when you go on the website, it does not show the top part, the actual site menu, how normally any site uploads or refreshes. It starts almost at the bottom of the page, where the contact form is. I did remove the contact form but it's the same thing, the webpage defaults to the same area. I really have no idea why and how can I solve it? Maybe it's something to do with Bootstrap, some hidden thing I am not aware of?
If you want the actual code, I will supply it but since it's quite a lot for a small page, I thought maybe you can just view the code source directly.
Any advice is much appreciated. I cannot send a E Resume when it's always getting to that contact form, it's annoying, even if accounts people will look at it.
Thank you,
Lavinia
That's because your input element is set to autofocus:
<input type="text" size="50" name="VisitorName" maxlength="30" required="" autofocus="">
Remove the autofocus attribute and it should be fine:
<input type="text" size="50" name="VisitorName" maxlength="30" required="">

Passing variables? wordpress

Hello all I'm very thankful for this community here, wouldn't know what to do without you all.
First of all, I'm not even sure if the title to this post is accurate; please read on. In a nutshell what I'm trying to do in Wordpress is create a 'reply' button that will be displayed on the individual post's page. When someone clicks on this 'reply' button it will take them to a different WP page that is using a private messaging plugin. On this page I would like the 'to:' field to automatically know who to reply to (author of the post).
Now here's my question. Is this accomplished by "passing a variable" from first page to the second or is there another way to do this?
I'm not asking for specific code help so please don't tell me to go talk with the plugin developer. I'm just trying to get a general idea of how something like can be accomplished so that I can do some research myself.
At the very least, If someone get give me a starting point for me to do some google research that would be all I need. Being fairly new I don't even know what phrase I should be googling for.
Yes, you can do that by implementing simple wp plugin. First of all you need to know that, there are lots of wp specific functions. You can use the_content for putting your reply link after post content, and get_author_meta in order to get post's author email for putting it in your custom link. I know, you don't want to talk about code, but I can give you sample example; In order to apply this functionality on all post, you can simply implement a plugin.
Edit: For redirecting to Private Messaging plugin's send page with prepopulated recipient field, I have updated get_the_author_meta('email') with get_the_author_meta('user_login'). Now, you can go to mail send page, by clicking Reply link
add_filter('the_content', 'add_custom_link');
function add_custom_link($content) { // You can think that $content => individual post
if(is_single()) {
$content .= 'Reply to this post';
}
return $content;
}
Save this code in a php file and zip it.Then, upload it to your wp site as plugin. And you will see your custom link at the end of your posts. Do not forget to update variables in plugin according to your needs(for example reply url domain)
Here is a working plugin demo: http://huseyinbabal.eu01.aws.af.cm/?p=1
Create a form that posts to the secondary page.
Use a hidden form field to pass the post ID
Make sure you prefix the form fields so your $_POST variable doesn't conflict with any other core/plugin variables
On the secondary page: make sure you sanitize that user input before you do anything else
with it
use the sanitized post id to look up the post's author, without
having to expose the author's email in the url.
Your Form should look something like so:
<form action="url-of-page-2" method="POST">
<input type="hidden" name="myprefix_id" value="<?php echo get_the_ID();?>">
<input type="submit" value="reply">
</form>

displaying poll data on ExpressionEngine site

I'm using the eeHarbor polls module and need help with the following:
As the code is currently configured, the poll question displays on my homepage. If the user either selects an option and casts a vote, or clicks on the "view results" option, the results are then displayed within the same area on the homepage (replacing the poll questions and options).
I would like to have the results (either after a vote is cast or after the user selects "view results") displayed on a different page, where I can add related content. Does anyone know how I may edit the poll module's parameters to make this happen?
Also, the poll module creates all new polls with 2 possible voting options/answers. There is a link to click that should allow the admin to "add options" or "add other option" but clicking this link doesn't dork, leaving me with only 2 options for every poll.
I have uninstalled and reinstalled the module with no change.
Any ideas why this is happening and how it may be resolved?
Check the FAQ page here: http://eeharbor.com/polls/faq
Can I change the return URL for a given poll?
Yes, as of version 1.4 you can add a hidden form element with the name of "return_url" to specify the url you would like a user to be sent to after submitting a poll.
<input type="hidden" name="return_url" value="" />

joomla user authentication by my own custom written form inputs

I've been struggling to find out about user authentication using your own form elements.
In order to make it clear, heres what i want to do.
I'm going to have a button which is going to redirect to a page.
Now, this page can be redirected to in the following ways.
A popup opens where the user needs to enter their email address and password.
My form is like this
<form action="userlogin.php" method="post">
<ul>Email
<li><input type="text" id="email" name="email" /></li>
</ul>
<ul>Password
<li><input type="password" id="pass" name="pass" /> </li>
</ul>
</form>
The user clicks the submit button and if the email address and password exist then we have a successful login and if they dont then we add that user in the database and then redirect.
I dont understand how to authenticate user login using this form i've mentioned about. Which file do i have to post it to and how can it work like a normal joomla login.
Please do help.
Thanks.
You can write your own authentication routine relatively easily in two steps.
Authentication Logic
For the authentication logic, in the plugins folder, there is another folder called "authentication". Aside from the default joomla authentication, there is another called "example.php", which you can clone and work on from there. These are the plugins that you can enable/disable in the plugins manager in your Joomla Administrator, so you can look at them and see the different ways that they authenicate (gmail, openid, etc.).
Be sure to scan/replace all the naming used in the copied file (it's not very big), and when you're happy with it, make an entry in table jos_plugins so that you can enable it in the Joomla administrator.
Your Form (using template atomic as the example, and assuming you're using mod_login)
Within /templates/atomic/html/mod_login you should have, a file called default.php. This is where you change the form to suit your needs, and incorporate into the authentication logic your wrote in the plugin.
Popup Approach
That will depend on the template you're using, and how it, or you, generally handle popups. Rockettheme have many popup modules (some being free) which demonstrate how you could do it that way, or jquery if you're comfortable with that, the list goes on....
You could override the existing login form and open this in a modal popup?