magento newsletter subscription not working in magento 1.9.2.2 - php

newsletter subscription not working in all pages. no newsletter confirmation mail send to customers
<div class="custom-subscribe">
<div class="title">
<span><?php echo $this->__('Newsletter') ?></span>
</div>
<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail">
<div class="form-subscribe-header">
<label for="newsletter"><?php echo $this->__('Sign Up for Our Newsletter:') ?></label>
</div>
<div class="input-box">
<input type="text" name="email" id="newsletter" title="<?php echo $this->__('Sign up for our newsletter') ?>" class="input-text required-entry validate-email form-control" />
</div>
<div class="actions">
<button type="submit" title="<?php echo $this->__('Subscribe') ?>" class="button"><span><span><?php echo $this->__('Subscribe') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail');
//]]>
</script>

Please check below solutions:
In the Magento backend "System > Permissions > Variables" and "System > Permissions > Blocks"
Add newsletter/subscribe and refreshed cache.
More info:
There is a new check on the template directive, see Mage_Core_Model_Email_Template_Filter::blockDirective() line 176
if ($this->_permissionBlock->isTypeAllowed($blockParameters['type'])) {
$type = $blockParameters['type'];
$block = $layout->createBlock($type, null, $blockParameters);
}
Also check in system configuration as below:
System--->Advanced--->Advanced

Related

Bootstrap 4 Image product didn't line up properly

I'm tryin to make a simple online shopping page for my PHP training.
But, I'm kinda stuck in the HTML part where using bootstrap didn't make
something more simpler.
The result of the code makes my product line up vertically, and what I want to with it is to make it line up horizontally.
Code :
<div class="container">
<?php
$connect = mysqli_connect('localhost', 'root', '', 'cart');
$query = 'SELECT * FROM products ORDER by id ASC';
$result = mysqli_query($connect, $query);
if ($result):
if (mysqli_num_rows($result)>0):
while ($product = mysqli_fetch_assoc($result)):
//print_r($product);
?>
<div class="col-sm-4">
<form class="" action="welcome.php?action=add&id=<?php echo $product['id'] ?>" method="post">
<div class="products">
<img src="<?php echo $product['image']; ?>" class="img-fluid text-center" />
<h4 class="text-info"><?php echo $product['name']; ?></h4>
<h4>$ <?php echo $product['price']; ?></h4>
<input type="text" name="quantity" class="form-control" value="1" />
<input type="hidden" name="name" value="<?php echo $product['name'] ?>" />
<input type="hidden" name="price" value="<?php echo $product['price']; ?>" />
<button type="submit" name="add_to_cart" class="btn btn-outline-primary">Add to Cart</button>
</div>
</form>
</div>
<?php
endwhile;
endif;
endif;
?>
For bootstrap grid system to work , the tags must be in following order:
<div class="container">
<div class="row">
<div class="col-md-6">
One of two columns
</div>
<div class="col-md-6">
One of two columns
</div>
</div>
</div>

Is it possible to have two actions fire on a form?

I understand you can't have two form elements. Here is my code below:
<form method="post" action="http://enews.thewebsite.com/q/Z_-p5ayQihZRLi2J67qUQ1aYrMDxK9jLRT" accept-charset="UTF-8">
<form action="<?php echo $this->getFormActionUrl() ?>" method="post" id="newsletter-validate-detail<?php echo $this->getAdditionalFormId(); ?>">
<input type="hidden" name="crvs" value="hj8DUzs3ID-3PTnoCEYQBZnP-ywiXCvSIopgDNLjkjI8uXaXEdhIDPteMAiIyBcEx_IEuTzvEtyZyY_6wp6uKKp5ljddRi7lbgSnjg9EM_tdAFCK1mCGHA7rrAZ8_zyk1GjuYtSzOIe60HJ-s5oV9doy1naJOZ-afDbkKAOxuVw"/>
<div class="form-subscribe">
<div class="form-subscribe-header">
<label for="newsletter"><?php echo $this->__('Sign Up to Receive Our Newsletters') ?></label>
</div>
<div class="form-subscribe-input"><input name="email" type="text" id="newsletter" value="<?php echo $this->__('Email Address') ?>" onclick="this.value=='<?php echo $this->__('Email Address') ?>'?this.value='':''" onblur="this.value==''?this.value='<?php echo $this->__('Email Address') ?>':''" class="input-text required-entry validate-email" /></div>
<div class="form-subscribe-submit"><button type="submit" class="button" title="<?php echo $this->__('Sign Up') ?>"><span><?php echo $this->__('Sign Up') ?></span></button></div>
</div>
</form></form>
<script type="text/javascript">
//<![CDATA[
var newsletterSubscriberFormDetail = new VarienForm('newsletter-validate-detail<?php echo $this->getAdditionalFormId(); ?>');
//]]>
</script>
The first post action is the one that is taking precedence. I would like them both to fire in the order they are now.
Is this possible?
Perhaps i can use some javascript like so:
<script type="text/javascript">
function doPreview()
{
form=document.getElementById('newsletter-validate-detail');
form.target='_blank';
form.action='thewebsite'; //first action
form.submit();
form.action='backto-other-action'; //second action???
form.target='';
}
</script>

Add search fields to search bar magento

A friend has asked me to look at a website they had built (long story short they fell out so site didnt get finished). There is a search bar on the left hand side with 3 different search categories
Ive found the code for it in form.mini.phtml
<div id="search1">
<h3>
SEARCH >>>
</h3>
<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
<div id="label_area">
<div id="label_area">
</div>
<input type="text" name="label" id="label" value="Label >>>" onclick="if(this.value!='Label >>>'){ } else { this.value =''; } "size="15" class="text2">
</div>
<div id="label_area">
<div id="label_area">
</div>
<input type="text" name="artist" id="artist" value="Artists >>>" onclick="if(this.value!='Artists >>>'){ } else { this.value =''; } "size="15" class="text2">
</div>
<div id="label_area">
<div id="label_area">
</div>
<input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="text2" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" /></div>
<div id="label_area"> <input type="image" src="<?php echo $this->getSkinUrl('images/go.jpg')?>" />
</div>
</form>
</div>
<!--<form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
<div class="form-search">
<label for="search"><?php echo $this->__('Search:') ?></label>
<input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" value="<?php echo $catalogSearchHelper->getEscapedQueryText() ?>" class="input-text" maxlength="<?php echo $catalogSearchHelper->getMaxQueryLength();?>" />
<button type="submit" title="<?php echo $this->__('Search') ?>" class="button"><span><span><?php echo $this->__('Search') ?></span></span> </button>-->
<div id="search_autocomplete" class="search-autocomplete"></div>
<script type="text/javascript">
//<![CDATA[
var searchForm = new Varien.searchForm('search_mini_form', 'search', '<?php echo $this->__('Keywords>>>>>>>') ?>');
searchForm.initAutocomplete('<?php echo $catalogSearchHelper->getSuggestUrl() ?>', 'search_autocomplete');
//]]>
</script>
<!-- </div>
</form>-->
It looks like the developer has hashed this together, My question is, how do go about getting the label/artist fields working? sorry for the clumsiness, Im a novice with PhP, Ive tried a couple of approaches with no joy, thank you very much in advance :)

How to add message after submitting form? PHP, Wordpress

I trying to make a feature, where the user recieves a message saying "Your changes have been saved" after the user has pressed "save changes". When the form is being submittet the page is just refreshed and not redirected to any other page.
I have tried several things but nothing seems to work. I am good at HTML but not PHP. I would love if any of you could help me out!
My code for my profile template is the folowing:
<div class="user-image">
<div class="bordered-image thick-border">
<?php echo get_avatar(ThemexUser::$data['user']['ID'], 200); ?>
</div>
<div class="user-image-uploader">
<form action="<?php echo themex_url(); ?>" enctype="multipart/form-data" method="POST">
<label for="avatar" class="button"><span class="button-icon upload"></span><?php _e('Skift billede','academy'); ?></label>
<input type="file" class="shifted" id="avatar" name="avatar" />
<input type="hidden" name="user_action" value="update_avatar" />
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" />
</form>
</div>
</div>
<div class="user-description">
<form action="<?php echo themex_url(); ?>" class="formatted-form" method="POST">
<div class="message">
<?php ThemexInterface::renderMessages(); ?>
</div>
<div class="sixcol column">
<div class="field-wrapper">
<input type="text" name="first_name" size="30" value="<?php echo ThemexUser::$data['user']['profile']['first_name']; ?>" placeholder="<?php _e('Fornavn','academy'); ?>" />
</div>
</div>
<div class="sixcol column last">
<div class="field-wrapper">
<input type="text" name="last_name" size="30" value="<?php echo ThemexUser::$data['user']['profile']['last_name']; ?>" placeholder="<?php _e('Efternavn','academy'); ?>" />
</div>
</div>
<div class="clear"></div>
<!-- ADRESSE -->
<?php if(!ThemexCore::checkOption('profile_signature')) { ?>
<div class="field-wrapper">
<input type="text" name="signature" value="<?php echo ThemexUser::$data['user']['profile']['signature']; ?>" placeholder="<?php _e('Adresse','academy'); ?>" />
</div>
<?php } ?>
<div class="user-fields">
<?php ThemexForm::renderData('profile', array(), ThemexUser::$data['user']['profile']); ?>
</div>
<?php } ?>
<span class="button-icon save"> </span><?php _e('Gem ændringer','academy'); ?>
<input type="hidden" name="user_action" value="update_profile" />
<input type="hidden" name="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" />
</form>
</div>
you are submitting to another url. So you can add something like the below to your functions file to display a message when the url is appended with msg. (you can account for multiple messages using the switch below, look it up) also you will need to add `?msg=yourmessagevariable' to your form action.
add_action('wp_print_scripts', 'notifcation', 100);
function notifcation () {
if($_GET['msg']) {
$message= sanitize_text_field($_GET['msg']);
switch($message) {
case 'reg-business':
$notehead= 'Please register first';
$msg= 'Please register your business before continuing';
break;
case 'nowvalid':
$notehead= "Congratulations";
$msg='You have successfully connected ';
break;
case 'Completed':
$notehead= 'Edited';
$msg='You have successfully edited your advert';
break;
}
?>
<section id="notification" class="notif notif-notice">
<h6 class="notif-title"><?php echo $notehead;?></h6>
<p><?php echo $msg; ?></p>
<div class="notif-controls">
Close
</div>
</section>
<script type="text/javascript">
jQuery(document).ready(function() {
setTimeout(function(){
jQuery('#notification').css('display', 'none');
},3000)
});
jQuery('.notif-close').click(function(e){
e.preventDefault();
jQuery(this).parent().parent().css('display', 'none');
})
</script>
<?php
}
}

Subscribe Wordpress user at registration to membership plan?

I'm using a template for Wordpress that has membership functions built-in, including membership plans.
What I'm trying to do is duplicate the Registration page and have everyone who create an account using the signup form on this page get automatically subscribed to a paid membership plan for free.
So I created a new signup page by duplicating the original one. I asked the developer of the template and he said I need to use this function somewhere on the page to subscribe the users to the paid plan. Here's the function:
ThemexCourse::subscribeUser(5244, $user, true);
5244 is the ID of the paid plan on the site.
Any idea how to configure the signup form using this function so that everyone who signs up gets subscribed to the paid plan?
Here's the sign up form code:
<?php
/*
Template Name: Custom Registration
*/
?>
<?php get_header(); ?>
<?php if(get_option('users_can_register')) { ?>
<h1><?php _e('Register Your Account','academy'); ?></h1>
<form class="ajax-form formatted-form" action="<?php echo AJAX_URL; ?>" method="POST">
<div class="message"></div>
<div class="sixcol column">
<div class="field-wrapper">
<input type="text" name="user_login" placeholder="<?php _e('Username','academy'); ?>" />
</div>
</div>
<div class="sixcol column last">
<div class="field-wrapper">
<input type="text" name="user_email" placeholder="<?php _e('Email','academy'); ?>" />
</div>
</div>
<div class="clear"></div>
<div class="sixcol column">
<div class="field-wrapper">
<input type="password" name="user_password" placeholder="<?php _e('Password','academy'); ?>" />
</div>
</div>
<div class="sixcol column last">
<div class="field-wrapper">
<input type="password" name="user_password_repeat" placeholder="<?php _e('Repeat Password','academy'); ?>" />
</div>
</div>
<div class="clear"></div>
<?php if(ThemexCore::checkOption('user_captcha')) { ?>
<div class="form-captcha">
<img src="<?php echo THEMEX_URI; ?>assets/images/captcha/captcha.php" alt="" />
<input type="text" name="captcha" id="captcha" size="6" value="" />
</div>
<div class="clear"></div>
<?php } ?>
<span class="button-icon register"></span><?php _e('Register','academy'); ?>
<div class="form-loader"></div>
<input type="hidden" name="user_action" value="register_user" />
<input type="hidden" name="user_redirect" value="<?php echo themex_value($_POST, 'user_redirect'); ?>" />
<input type="hidden" name="nonce" class="nonce" value="<?php echo wp_create_nonce(THEMEX_PREFIX.'nonce'); ?>" />
<input type="hidden" name="action" class="action" value="<?php echo THEMEX_PREFIX; ?>update_user" />
</form>
<?php } ?>
<div class="clear"></div>
<?php
$query=new WP_Query(array(
'post_type' => 'page',
'meta_key' => '_wp_page_template',
'meta_value' => 'template-register.php'
));
if($query->have_posts()) {
$query->the_post();
echo '<br />';
the_content();
}
?>
<?php get_footer(); ?>
Such customization belong to the Plugins, not themes indeed. As mention in Customizing registration form codex page you may hook to one of the action hooks, to both customize the registration form and do some action after the form posts. The 3 action hooks are register_form, register_post, user_register.
For your particular question the action hook user_register must be hooked with your function preferably in a plugin.
add_action( 'user_register', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
....
ThemexCourse::subscribeUser(5244, $user, true);
....
}

Categories