X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   newsletter signup from html page (https://forum.x-cart.com/showthread.php?t=33757)

Vivarant 01-15-2009 11:05 AM

Re: newsletter signup from html page
 
hi i am trying to utilize this code but when you try to submit the email address this message comes up

"No news available at the moment"

Here is how is how i have the code set

Code:

<form name="newsletter" action="news.php" method="post"><center>
  <table width="250" border="0" align="left" cellpadding="2">
  <tr>
  <td width="50%"><input name="newsemail" size="35"></td>
  </tr>
  <tr>
  <td width="50%">
    <input type="radio" value="subscribe" checked name="mode">
    Subscribe     
    <input type="Submit" value="Submit" name="Submit"></td>
  </tr>
 </table>
 </center>

</form>


mixshows3 07-05-2011 12:59 AM

Re: newsletter signup from html page
 
Hello,
Tried this on 4.4.2 but its not working. Button doesn't do anything when pressed. I think it has to do with the authentication box (type numbers from image) that 4.4.2 requires on newsletter subscription page.

Can any X-Cart gurus help getting this to work with just the email field and submit button?

I really appreciate it.
Thanks
Cisco

qualiteam 07-13-2011 04:22 AM

Re: newsletter signup from html page
 
You can try something like this:
Code:

<form action="news.php" name="subscribeform" method="post">
  <input type="hidden" name="subscribe_lng" value="en">
  <table cellspacing="1" class="data-table">
    <tr>
      <td class="data-name"><label for="semail">Your email:</label></td>
      <td class="data-required">*</td>
      <td><input type="text" class="input-email" id="semail" name="newsemail" size="30" value=""></td>
    </tr>
    <tr>
      <td colspan="3" class="iv-box-descr">Type the characters you see in the picture:</td>
    </tr>
    <tr>
      <td class="iv-box">
        <div class="iv-img">
          <script type="text/javascript" src="/skin/common_files/js/common.js"></script>
          <script type="text/javascript" src="/skin/common_files/lib/jquery-min.js"></script>
          <script type="text/javascript">
            //<![CDATA[
            var xcart_web_dir = "";
            //]]>
          </script>
          <img src="/antibot_image.php?section=on_news_panel&amp;rnd=3826" id="on_news_panel" alt=""><br />
          <a href="javascript:void(0);" onclick="javascript: change_antibot_image('on_news_panel');" rel="noreferrer">Get a different code</a>
        </div>
      </td>
      <td class="data-required">*</td>
      <td class="iv-box">
        <input type="text" id="antibot_input_str" name="antibot_input_str">
        <div class="button-row">
          <button class="button" type="submit" title="Subscribe">
            <span class="button-right"><span class="button-left">Subscribe</span></span>
          </button>
        </div>
      </td>
    </tr>
  </table>
</form>


Or this:
Code:

<form action="news.php" method="post">
  <input type="hidden" name="mode" value="subscribe">
  <table cellspacing="1" class="data-table">
    <tr>
      <td class="data-name"><label for="semail">Your email:</label></td>
      <td class="data-required">*</td>
      <td><input type="text" class="input-email" id="semail" name="newsemail" size="30" value=""></td>
    </tr>
    <tr>
      <td colspan="3">
        <label class="news-item">
          <input type="checkbox" name="s_lists[]" value="1" checked="checked">
            News list1 name
        </label>
        <label class="news-item">
          <input type="checkbox" name="s_lists[]" value="2" checked="checked">
            News list2 name
        </label>
        <div class="button-row">
          <button class="button main-button" type="submit" title="Subscribe">
            <span class="button-right"><span class="button-left">Subscribe</span></span>
          </button>
        </div>
      </td>
    </tr>
  </table>
</form>

Replace the "value" with the real news list IDs and "News listX name" with the real news list name.

mixshows3 07-15-2011 11:47 AM

Re: newsletter signup from html page
 
Thanks for the help Alex!
I added both codes to the page and here are the results:

1st Code
This code still displays the "anti-bot" input field

2nd Code
Once email is typed in and submit button clicked it still goes to the newsletter page

The purpose of this is for customers to be able to join the newsletter quickly without going to the newsletter page. How can I achieve this result :
http://www.groupon.com/fort-lauderdale/ on top with just an email field and a submit button? As far as the "newsletter 1" and "newsletter 2" checkboxes I dont really need them since I dont plan on running more than a "DEALS" newsletter.

So can code not include "anti-bot" and not have specific newsletter checkboxes?


Quote:

Replace the "value" with the real news list IDs and "News listX name" with the real news list name.
Just to be clear is that the name of the newsletter? Such as "Deals" as it shows here under "news management" ?

thanks so much for your help.
Cisco


thanks
Cisco

qualiteam 07-18-2011 05:28 AM

Re: newsletter signup from html page
 
In this case you should use the following form:
Code:

<form name="news_subscription" action="news.php" method="post">
  <input type="hidden" name="mode" value="subscribe">

  <input type="hidden" name="s_lists[]" value="1">
  <input type="hidden" name="s_lists[]" value="2">
  ...
  <input type="hidden" name="s_lists[]" value="[N]">

  <input type="hidden" name="skip_validation" value="Y">
  <input type="text" name="newsemail" size="30" value="">

  <input type="hidden" name="sl" value="en">

  <button class="button main-button" type="submit" title="Subscribe">
    <span class="button-right"><span class="button-left">Subscribe</span></span>
  </button>
</form>


Add all the necessary lists:
Code:

<input type="hidden" name="s_lists[]" value="[N]">

The list ID [N] can be found on admin/news.php (see the "targetlist" URL param for the corresponding news list).

Insert this code:
PHP Code:

if ($news_lists_num && $mode == "subscribe" && $skip_validation == 'Y') {
    
$validated_emails[] = stripslashes($email);



right before this line:
PHP Code:

if ($mode == 'view' || ($mode == "subscribe" && in_array(stripslashes($email), $validated_emails))) { 


in the "modules/News_Management/news_manage.php" script.

mixshows3 07-18-2011 11:18 AM

Re: newsletter signup from html page
 
Ok
This is what I have on the page:



Code:

<form name="news_subscription" action="news.php" method="post">
  <input type="hidden" name="mode" value="subscribe">

  <input type="hidden" name="s_lists[]" value="[1]">

  <input type="hidden" name="skip_validation" value="Y">
  <input type="text" name="newsemail" size="30" value="">

  <input type="hidden" name="sl" value="en">

  <button class="button main-button" type="submit" title="Subscribe">
    <span class="button-right"><span class="button-left">Subscribe</span></span>
  </button>
</form>



I made the necessary changes to news_management.php. I then go test by adding an email to the field but it still takes me to the news.php page. What am I doing wrong?
I really apreciate it Alex.
Cisco

qualiteam 07-19-2011 04:24 AM

Re: newsletter signup from html page
 
It seems the ID is not correct, try replacing this code:
Code:

<input type="hidden" name="s_lists[]" value="[1]">
with the new one:
Code:

<input type="hidden" name="s_lists[]" value="1">

Also, make sure the newslist with ID 1, exists in DB (http://.../admin/news.php?targetlist=1)

mixshows3 07-19-2011 07:01 AM

Re: newsletter signup from html page
 
Hello Alex,
Still no good :(
The newsletter exists in database as "1". I edited the value but still the same results. Here is the website

http://www.ilovemywatches.com

I appreciate your patience :D

Cisco

mixshows3 07-25-2011 05:09 AM

Re: newsletter signup from html page
 
Can anyone out there please lend a hand? Just a quick look over and point me in the right direction? this could be of help to many x-cart customers.
thanks

mixshows3 07-25-2011 05:21 AM

Re: newsletter signup from html page
 
Got it working! I compared the working code on the original signup page (news.php) and realized the input name "subscribe_lng" and id "semail" were different. It may not be perfect but it works!


This is the code I used to get the newsletter signup on the front page of our store without verification image check:


Code:

<form name="subscribeform" action="news.php" method="post">
  <input type="hidden" name="subscribe_lng" value="en">

  <input type="hidden" name="s_lists[]" value="1">

  <input type="hidden" name="skip_validation" value="Y">
  <input type="text" name="newsemail" size="30" id="semail" value="">

  <input type="hidden" name="sl" value="en">

  <button class="button main-button" type="submit" title="Subscribe">
 
 
    <span class="button-right"><span class="button-left">Subscribe</span></span>
  </button>
</form>





Also make sure you disable image verification on the modules section for newsletters.
Thanks Alex for you help!


All times are GMT -8. The time now is 12:50 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.