I'm trying to customize the confirmation email template that sends the Drupal webform by following
<?php print ($email['html'] ? '<p>' : '') .t('----,') .($email['html'] ? '</p>' : ''); ?>
<?php print ($email['html'] ? '<p> <b>' : '') .t('Michel Kevorkian') .($email['html'] ? '</b></p>' : ''); ?>
<?php print ($email['html'] ? '<p>' : '') .t('23 rue du Départ') .($email['html'] ? '</p>' : ''); ?>
<?php print ($email['html'] ? '<p>' : '') .t('75014 Paris') .($email['html'] ? '</p>' : ''); ?>
<?php print ($email['html'] ? '<p>' : '') .t('T: + 33 6 64 30 24 03') .($email['html'] ? '</p>' : ''); ?>
<?php print ($email['html'] ? '<p>' : '') .t('T: + 374 55 94 75') .($email['html'] ? '</p>' : ''); ?>
<?php print ($email['html'] ? '<p>' : '') .t('www.asifabtp.fr') .($email['html'] ? '</p>' : ''); ?>
I need to add the company logo as part of signature like this
LOGO GOES HERE
23 rue du Départ
75014 Paris
T: + 33 6 64 30 24 03
T: + 374 55 94 75
www.asifabtp.fr
any ideas ?
http://cheekymonkeymedia.ca/blog/drupal-planet/4-easy-steps-configure-drupal-send-html-emails
This tutorial shows how it is done
For this you need 2 modules
https://www.drupal.org/project/mailsystem
https://www.drupal.org/project/mimemail
Related
I try to edit price filter of magento 1.9. when click on first range of filter it give me wrong result bcz its minimum value is 0.00 I want to change this 0.00 to 1 .
For this,
You have to maintain the minimum price is Rs.1 for the products.
First, Check if any product has price 0 in your admin panel. if has, modify. Then sure you will get the solution.
You can change the price filter value with this:
<?php
$getLabel = $_item->getLabel();
if (strpos($getLabel, 'price')!== false) :?>
<a class="multi-select unselected" href="<?php echo $this->urlEscape($_item->getUrl()) ?>">
<?php
$getValue = $_item->getValue();
$fitlerPrices = str_replace('-', ' - ', $getValue);
$file = basename($fitlerPrices);
$parts = explode("-", $file);
$getCurency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
$priceBefore = $getCurency . number_format($parts[0], 0);
$priceAfter = $getCurency . number_format($parts[1], 0); ?>
<?php
if($i == $count){
//item terakhir
echo '<span class="price">' . $priceBefore . 'and Above</span>';
}elseif($i <= 1){
//item pertama
echo '<span class="price">Below ' . $priceAfter . '</span>';
}else{
echo '<span class="price">' . $priceBefore . ' - ' .$priceAfter . '</span>';
}
?>
</a>
<?php else :?>
<a class="multi-select unselected" href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel(); ?></a>
<?php endif?>
I need to add active class to my topmenu. And i already saw a bunch of subjects on forums, but i didn't saw code like i have. Can you please hepl me. I tried to "echo $currentUrl" but this what i saw " localhost.com/app/etc/local.xml "
<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
<?php
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$baseUrl = Mage::getBaseUrl();
$locale = Mage::app()->getLocale()->getLocaleCode();
$_topMenuItems['ru_RU'] = array(
/*$this->__('Home') => $baseUrl,*/
$this->__('IIW, Delivery and payment') => $baseUrl . 'dostavka-oplata.html',
$this->__('IIW, About us') => $baseUrl . 'pro-nas-kategorija.html',
$this->__('IIW, Partners') => $baseUrl . 'partneram.html',
$this->__('IIW, Contacts') => $baseUrl . 'contacts',
$this->__('IIW, It is interesting') => $baseUrl . 'korisna-informacija.html',
/* $this->__('IIW, Where to buy') => $baseUrl . 'de-prudbatu.html', */
);
?>
<nav id="nav">
<ol class="nav-primary">
<?php
$i = 0;
$length = count($_topMenuItems[$locale]);
foreach ($_topMenuItems[$locale] as $label => $_itemUrl) {
if ($i == 0) {
echo $_menu;
}
$customMenuClass = ' cm-' . ($i + 1);
if ($i == 0) {
$customMenuClass .= ' first';
} elseif ($i == ($length - 1)) {
$customMenuClass .= ' last';
}
if (trim($currentUrl, '/') == trim($_itemUrl, '/')) {
$customMenuClass .= ' active';
}
?>
<li class="level0<?php echo $customMenuClass ?>">
<?php echo $label ?>
</li>
<?php
$i++;
}
?>
</ol>
</nav>
<script>
jQuery(document).ready(function($){
var locationUrl = location.href;
$(".yourmenu a.yourclass").each(function() {
var menuLinkHref = $(this).attr("href");
if (~locationUrl.indexOf(menuLinkHref)) {
$(this).addClass("active");
}
});
});
</script>
JS solution if you need
.yourmenu - class of the menu, where your links must change class .actve;
.yourclass - class allready used for each link in the menu (ex.".menu_item_link").
hi all how to get onchange value after select navigation menu in magento?
i trying to following code in topmenu.phtmlbut it's not working proper showing page is not found
But it's not working properly. What do i do?
you can try something like this
<select id="nav" class="nav" onchange="if (this.value) window.location.href=this.value">
Update Topmenu.php code with below code.
Remove this:
$html .= '<option ' . $this->_getRenderedMenuItemAttributes($child) . '>';
$html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>';
if ($child->hasChildren()) {
if (!empty($childrenWrapClass)) {
$html .= '<div class="' . $childrenWrapClass . '">';
}
$html .= '<ul class="level' . $childLevel . '">';
$html .= $this->_getHtml($child, $childrenWrapClass);
$html .= '</ul>';
if (!empty($childrenWrapClass)) {
$html .= '</div>';
}
}
$html .= '</option>';
Add below code:
$html .= '<option value="' . $child->getUrl() . '" '>'. $this->escapeHtml($child->getName()) . '</option>';
if ($child->hasChildren()) {
$html .= $this->_getHtml($child, $childrenWrapClass);
}
And update select onchange code with below code:
onchange="if (this.value) window.location.href=this.value"
I am trying to make a booking form with checkboxes using an existing contact form.js script and mailhandler.php from template monster. All of the text and textarea inputs work fine but the checkboxes only return the word array.
Here's parts of the code:
html
<form action="bin/MailHandler.php" method="post" id="booking-form" >
<fieldset>
<div class="grid_12">
<div class="bookingformwrapper">
<div class="headerbar">WAXING</div>
intrested in:<br/>
<input type="checkbox" name="waxing[]" value="kidum_esek" id="wax1"/>aaa<br />
<input type="checkbox" name="waxing[]" value="mitug_esek" id="wax2"/>bbb<br />
<input type="checkbox" name="waxing[]" value="laikim" id="wax3"/>CCC<br />
<input type="checkbox" name="waxing[]" value="aher" id="wax4"/>DDD<br />
ajax jquery
,submitFu:function(){
var data = { 'waxing[]' : []};
$(":checked").each(function() {
data['waxing[]'].push($(this).val());
});
_.validateFu(_.labels)
if(!_.form.has('.'+_.invalidCl).length)
$.ajax({
type: "POST",
url:_.mailHandlerURL,
data:{
choice:'waxing[]',
name:_.getValFromLabel($('.name',_.form)),
email:_.getValFromLabel($('.email',_.form)),
phone:_.getValFromLabel($('.phone',_.form)),
fax:_.getValFromLabel($('.fax',_.form)),
state:_.getValFromLabel($('.state',_.form)),
message:_.getValFromLabel($('.message',_.form)),
message2:_.getValFromLabel($('.message2',_.form)),
datepicker:_.getValFromLabel($('#datepicker',_.form)),
owner_email:_.ownerEmail,
stripHTML:_.stripHTML
},
success: function(){
_.showFu()
}
})
},
php
<?php
$owner_email = $_POST["owner_email"];
$headers = 'From:' . $_POST["email"];
$subject = 'A message from your site visitor ' . $_POST["name"];
$messageBody = "";
if($POST['waxing[]'] !='nope'){
$messageBody .= '<p>Choice: ' . explode(",", $_POST['waxing[]']);
$messageBody .= '<br>' . "\n";
}
if($_POST['name']!='nope'){
$messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['email']!='nope'){
$messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}else{
$headers = '';
}
if($_POST['state']!='nope'){
$messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['phone']!='nope'){
$messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['fax']!='nope'){
$messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['datepicker']!='nope'){
$messageBody .= '<p>Date: ' . $_POST['datepicker'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['message']!='nope'){
$messageBody .= '<p>Address: ' . $_POST['message'] . '</p>' . "\n";
}
if($_POST['message2']!='nope'){
$messageBody .= '<p>Notes: ' . $_POST['message2'] . '</p>' . "\n";
}
if($_POST["stripHTML"] == 'true'){
$messageBody = strip_tags($messageBody);
}
try{
if(!mail($owner_email, $subject, $messageBody, $headers)){
throw new Exception('mail failed');
}else{
echo 'mail sent';
}
}catch(Exception $e){
echo $e->getMessage() ."\n";
}
?>
This is what gets returned on the email:
Choice: Array
Visitor: Father Christmas
Email Address: father#christmas.com
Phone Number: 01234 567890
Date: 25th December
Address: North Pole
Notes: Mince Pies
Where it says Choice: Array, I need it to give me the values of the selected/checked checkboxes.
I'm currently using Magento 1.5.0.1
When a customer reigisters on the registration page (/account/create), he has to insert a date of birth (dob).
By default, the date of birth consists of 3 text-boxes. I have modified the file at /app/design/frontend/base/default/template/customer/widget.
So, instead of text-boxes there are now 3 select-boxes where the user can select a date
However, when all information is filled in correctly and you click on the "submit" button nothing happens (no errors, messages or anything).
Any idea on how to make the "submit" button work again?
Thanks
Edit:
The id's of the are the same as the one's used by the "". I've posted the code that I have changed
I've made 2 functions that print the options's element:
function getOptions($minValue, $maxValue)
{
$options = "";
for ($count = $minValue; $count <= $maxValue; $count++)
{
$options = $options . '<option value="' . $count . '">' . $count . '</option>';
}
return $options;
}
function getYears()
{
$years = "";
$currentYear = date('Y');
for ($count = 1900; $count <= $currentYear; $count++)
{
$years = $years . '<option value="' . $count;
if ($count == '1980')
{
$years = $years . '" selected="selected"';
}
$years = $years . '">' . $count . '</option>';
}
return $years;
}
And i've changed the input type=text to select
$this->setDateInput('d',
'<div class="dob-day">
<label for="' . $this->getFieldId('day') . '">' . $this->__('DD') . '</label>
<select id="' . $this->getFieldId('day') . '" name="' . $this->getFieldName('day') . '" title="' . $this->__('Day') . '" class="validate-select" ' . $this->getFieldParams() . '>' . getOptions(1,31) . '
</select>
</div>
<br />');
$this->setDateInput('m',
'<div class="dob-month">
<label for="' . $this->getFieldId('month') . '">' . $this->__('MM') . '</label>
<select id="' . $this->getFieldId('month') . '" name="' . $this->getFieldName('month') . '" title="' . $this->__('Month') . '" class="validate-select"' . $this->getFieldParams() . '>' . getOptions(1,12) . '
</select>
</div>
<br />');
$this->setDateInput('y',
'<div class="dob-year">
<label for="' . $this->getFieldId('year') . '">' . $this->__('YYYY') . '</label>
<select id="' . $this->getFieldId('year') . '" name="' . $this->getFieldName('year') . '" title="' . $this->__('Year') . '" class="validate-select"' . $this->getFieldParams() . '>' . getYears() . '
</div>'
);
Replace/create dob.phtml file located in app/design/frontend/[package-name]/default/template/customer/widget/
https://gist.github.com/ncla/7794502 (tested on Magento 1.8 community edition)
Accepted answer might work, but hiding inputs seems unacceptable. Also setDateInput, getSortedDateInputs methods are unnecessary, as you pass them HTML just to get them back.
If you try converting dob.phtml from input boxes to drop down boxes, Magento form validation will fail (throw JS error) because it can't find "day" input. So I just override Varien.DOB initialize function to select correct elements.
Plz replace the dob.phtml in
app/design/frontend/base/default/template/customer/widget/
to follwing code and override new field to old with the help of css
/////////////////////////////
<?php echo $this->getLayout()->createBlock('customer/widget_dob')
->setDate($this->getCustomer()->getDob())
->toHtml() ?>
// For checkout/onepage/billing.phtml:
<?php echo $this->getLayout()->createBlock('customer/widget_dob')
->setDate($this->getCustomer()->getDob())
->setFieldIdFormat('billing:%s')
->setFieldNameFormat('billing[%s]')
->toHtml() ?>
/* NOTE: Regarding styles - if we leave it this way, we'll move it to boxes.css
Alternatively we could calculate widths automatically using block input parameters.
*/
/**
* #see Mage_Customer_Block_Widget_Dob
*/
<label for="<?php echo $this->getFieldId('month')?>"<?php if ($this->isRequired()) echo ' class="required"' ?>><?php if ($this->isRequired()) echo '<em>*</em>' ?><?php echo $this->__('Date of Birth') ?></label>
<div class="input-box customer-dob">
<?php
$this->setDateInput('d',
'<div class="dob-day">
<input type="text" id="' . $this->getFieldId('day') . '" name="' . $this->getFieldName('day') . '" value="' . $this->getDay() . '" title="' . $this->__('Day') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
<label for="' . $this->getFieldId('day') . '">' . $this->__('DD') . '</label>
</div>'
);?>
<select name="nday" id="nday" onchange="getElementById('<?php echo $this->getFieldId('day');?>').value=this.value" style="width:90px;">
<option value="">Select</option>
<?php
for($i=1;$i<=31;$i++)
{
echo "<option value='".$i."'>".$i."</option>";
}
?>
</select>
<select name="nmon" id="nmon" onchange="getElementById('<?php echo $this->getFieldId('month');?>').value=this.value" style="width:90px;">
<option value=''>Select</option>
<?php echo '<option value="">'.$this->__("Select").'</option>'.'<option value="01">'.$this->__("January").'</option>'.'<option value="02">'.$this->__("February").'</option>'.'<option value="03">'.$this->__("March").'</option>'.'<option value="04">'.$this->__("April").'</option>'.'<option value="05">'.$this->__("May").'</option>'.'<option value="06">'.$this->__("June").'</option>'.'<option value="07">'.$this->__("July").'</option>'.'<option value="08">'.$this->__("August").'</option>'.'<option value="09">'.$this->__("September").'</option>'.'<option value="10">'.$this->__("October").'</option>'.'<option value="11">'.$this->__("November").'</option>'.'<option value="12">'.$this->__("December").'</option>'; ?>
</select>
<select name="nyear" id="nyear" onchange="getElementById('<?php echo $this->getFieldId('year');?>').value=this.value" style="width:90px;">
<option value="">Select</option>
<?php
for($j=date('Y')-80;$j<=date('Y');$j++)
{
echo "<option value='".$j."'>".$j."</option>";
}
?>
</select>
</p>
<?php
$this->setDateInput('m',
'<div class="dob-month">
<input type="text" id="' . $this->getFieldId('month') . '" name="' . $this->getFieldName('month') . '" value="' . $this->getMonth() . '" title="' . $this->__('Month') . '" class="input-text validate-custom" ' . $this->getFieldParams() . '/>
<label for="' . $this->getFieldId('month') . '">' . $this->__('MM') . '</label>
</div>'
);
$this->setDateInput('y',
'<div class="dob-year">
<input type="text" id="' . $this->getFieldId('year') . '" name="' . $this->getFieldName('year') . '" value="' . $this->getYear() . '" title="' . $this->__('Year') . '" class="input-text validate-custom" ' . $this->getFieldParams() . ' />
<label for="' . $this->getFieldId('year') . '">' . $this->__('YYYY') . '</label>
</div>'
);
?>
<?php echo $this->getSortedDateInputs() ?>
<div class="dob-full" style="display:none;">
<input type="hidden" id="<?php echo $this->getFieldId('dob')?>" name="<?php echo $this->getFieldName('dob')?>" />
</div>
<div class="validation-advice" style="display:none;"></div>
</div>
<script type="text/javascript">
//<![CDATA[
var customer_dob = new Varien.DOB('.customer-dob', <?php echo $this->isRequired() ? 'true' : 'false' ?>, '<?php echo $this->getDateFormat() ?>');
//]]>
</script>
////////////////////////////
it work fine .this is just an idea.......
enjoy
Thats how I did it. Maybe someone can use it
Grab the dob code from some site or from Magento default theme
Create your own widget template in your theme folder, for example customer/widget/dob-custom.phtml
Call this widget in your template file, for example
echo $this->getLayout()->createBlock('customer/widget_dob')->setTemplate('customer/widget/dob-custom.phtml')->toHtml();
The issue I think is because the format of the DD is not correct. You are generating a day like 1, 2, 3, 4... while it should be 01, 02, 03, 04,.. etc..
Regards!
I recently switched from ncla's solution to this:
http://www.endreywalder.com/blog/change-date-of-birth-field-to-select-boxes-in-magento/
Instead of displaying 01-12 for months, this will output the actual names which I like much better.
Tested on Magento 1.9.2