https://www.google.co.in/search?q=slider+for+magento+home+page
http://freemagento.blogspot.in/2012/10/how-to-display-magento-categories-on.html?view=sidebar
Step 1: Login magento admin panel goto pages under CMS
Click on content and enter below code
<!--Image Slider Start-->
<div id="slide" align="center">
<script type="text/javascript">// <![CDATA[
var image1=new Image()
image1.src="{{skin url=images/media/slideshow/1.jpg}}"
var image2=new Image()
image2.src="{{skin url=images/media/slideshow/2.jpg}}"
var image3=new Image()
image3.src="{{skin url=images/media/slideshow/3.jpg}}"
var image4=new Image()
image4.src="{{skin url=images/media/slideshow/4.jpg}}"
var image5=new Image()
image5.src="{{skin url=images/media/slideshow/5.jpg}}"
// ]]></script>
<a href="http://www.myhomendeco.com/index.php/bed-rooms.html"> <img src="{{skin url=images/1.jpg}}" alt="" name="slide" width="900" height="277" border="2" /></a>
<script type="text/javascript">// <![CDATA[
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",5000)
}
slideit()
// ]]></script>
</div>
<!--Image Slider End-->
Step 2: Go to below folder
skin/frontend/default/Your_theme/images/media/
create a folder(name:slideshow)
put 5 image files(give name 1.jpg,2.jpg,3.jpg,4.jpg,5.jpg)
and reload
meanwhile refresh and flush you magento cache
---------------------------------------------------------------------------------------------------------
add-a-image-slider-banner-in-magento-home-page
<!--Image Slider Start-->
<div align="center">
<script type="text/javascript">
var image1=new Image()
image1.src="{{skin url=images/banner_1.jpg}}"
var image2=new Image()
image2.src="{{skin url=images/banner_2.jpg}}"
var image3=new Image()
image3.src="{{skin url=images/banner_3.jpg}}"
</script>
<a href="http://##">
<img src="{{skin url=images/banner_1.jpg}}" border="2" name="slide" width="890" height="277" /></a>
<script>
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",5000)
}
slideit()
</script>
</div>
<!--Image Slider End-->
------------------------------------------------------------------------------
in magento there is no available methods for attach file. once we do it in magento by adding a following code
in mage/core/model/email/template.php at the end of file.
public function addAttachment(Zend_Pdf $pdf){
$file = $pdf->render();
$attachment = $this->getMail()->createAttachment($file);
$attachment->type = 'application/pdf';
$attachment->filename = 'yourfile.pdf';
}
but i prefer to use Zend_Mail to send mail with attached file.
for this u need to do following.
try{
$mail = new Zend_Mail();
$mail->setFrom("fromemail","fromname");
$mail->addTo("toemail","toname");
$mail->setSubject("subject");
$mail->setBodyHtml(" body text"); // here u also use setBodyText options.
// this is for to set the file format
$content = file_get_contents("$file_path");
$at = new Zend_Mime_Part($content);
$at->type = 'application/csv'; // if u have PDF then it would like -> 'application/pdf'
$at->disposition = Zend_Mime::DISPOSITION_INLINE;
$at->encoding = Zend_Mime::ENCODING_8BIT;
$at->filename = $filename;
$mail->addAttachment($at);
$mail->send();
}catch(Exception $e)
{
echo $e->getMassage();
}
and this is ready.. just go for it.
-----------------------------------------------------------------------------------------
Where
----------------------------------------------------
Go to the following file and edit it as appropriate
app\design\frontend\videocard\default\template\checkout\onepage\payment
<dl id="checkout-payment-method-load">
<?php
$methods = $this->getMethods();
$oneMethod = count($methods) <= 1;
?>
<?php
$nopay = false;
foreach ($methods as $_method):
$_code = $_method->getCode();
if($_code == 'free') {
$nopay = true;
}
endforeach;
?>
<?php
foreach ($methods as $_method):
$_code = $_method->getCode();
?>
<dt>
<?php if ($nopay == false) : ?>
<?php if(!$oneMethod): ?>
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> />
<?php else: ?>
<span><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span>
<?php $oneMethod = $_code; ?>
<?php endif; ?>
<label for="p_method_<?php echo $_code ?>"><?php echo $this->getMethodTitle($_method) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
</dt>
<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
<dd>
<?php echo $html; ?>
</dd>
<?php endif; ?>
<?php else : ?>
<?php if($_code == 'free') : ?>
<span><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span>
<?php $oneMethod = $_code; ?>
<label for="p_method_<?php echo $_code ?>"><?php echo $this->getMethodTitle($_method) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
</dt>
<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
<dd>
<?php echo $html; ?>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</dl>
<?php echo $this->getChildChildHtml('additional'); ?>
<script type="text/javascript">
//<![CDATA[
<?php echo $this->getChildChildHtml('scripts'); ?>
payment.init();
<?php if (is_string($oneMethod)): ?>
payment.switchMethod('<?php echo $oneMethod ?>');
<?php endif; ?>
//]]>
</script>
--------------------------
http://freemagento.blogspot.in/2012/10/how-to-display-magento-categories-on.html?view=sidebar
How to add slideshow on magento homepage
How to add slideshow on magento homepageStep 1: Login magento admin panel goto pages under CMS
Click on content and enter below code
<!--Image Slider Start-->
<div id="slide" align="center">
<script type="text/javascript">// <![CDATA[
var image1=new Image()
image1.src="{{skin url=images/media/slideshow/1.jpg}}"
var image2=new Image()
image2.src="{{skin url=images/media/slideshow/2.jpg}}"
var image3=new Image()
image3.src="{{skin url=images/media/slideshow/3.jpg}}"
var image4=new Image()
image4.src="{{skin url=images/media/slideshow/4.jpg}}"
var image5=new Image()
image5.src="{{skin url=images/media/slideshow/5.jpg}}"
// ]]></script>
<a href="http://www.myhomendeco.com/index.php/bed-rooms.html"> <img src="{{skin url=images/1.jpg}}" alt="" name="slide" width="900" height="277" border="2" /></a>
<script type="text/javascript">// <![CDATA[
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",5000)
}
slideit()
// ]]></script>
</div>
<!--Image Slider End-->
Step 2: Go to below folder
skin/frontend/default/Your_theme/images/media/
create a folder(name:slideshow)
put 5 image files(give name 1.jpg,2.jpg,3.jpg,4.jpg,5.jpg)
and reload
meanwhile refresh and flush you magento cache
---------------------------------------------------------------------------------------------------------
add-a-image-slider-banner-in-magento-home-page
<!--Image Slider Start-->
<div align="center">
<script type="text/javascript">
var image1=new Image()
image1.src="{{skin url=images/banner_1.jpg}}"
var image2=new Image()
image2.src="{{skin url=images/banner_2.jpg}}"
var image3=new Image()
image3.src="{{skin url=images/banner_3.jpg}}"
</script>
<a href="http://##">
<img src="{{skin url=images/banner_1.jpg}}" border="2" name="slide" width="890" height="277" /></a>
<script>
//variable that will increment through the images
var step=1
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<3)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",5000)
}
slideit()
</script>
</div>
<!--Image Slider End-->
------------------------------------------------------------------------------
send mail with attached file
in mage/core/model/email/template.php at the end of file.
public function addAttachment(Zend_Pdf $pdf){
$file = $pdf->render();
$attachment = $this->getMail()->createAttachment($file);
$attachment->type = 'application/pdf';
$attachment->filename = 'yourfile.pdf';
}
but i prefer to use Zend_Mail to send mail with attached file.
for this u need to do following.
try{
$mail = new Zend_Mail();
$mail->setFrom("fromemail","fromname");
$mail->addTo("toemail","toname");
$mail->setSubject("subject");
$mail->setBodyHtml(" body text"); // here u also use setBodyText options.
// this is for to set the file format
$content = file_get_contents("$file_path");
$at = new Zend_Mime_Part($content);
$at->type = 'application/csv'; // if u have PDF then it would like -> 'application/pdf'
$at->disposition = Zend_Mime::DISPOSITION_INLINE;
$at->encoding = Zend_Mime::ENCODING_8BIT;
$at->filename = $filename;
$mail->addAttachment($at);
$mail->send();
}catch(Exception $e)
{
echo $e->getMassage();
}
and this is ready.. just go for it.
-----------------------------------------------------------------------------------------
Magento payment option
In yourconfig.xml
from app>code>your_codepol>Namespace>module>etc>config.xml
<frontend>
<events>
<payment_method_is_active>
<observers>
<paymentfilter_payment_method_is_active>
<type>singleton</type>
<class>YOUR_CLASS_observer</class>
<method>paymentMethodIsActive</method>
</paymentfilter_payment_method_is_active>
</observers>
</payment_method_is_active>
</events>
</frontend>
and create your observer and write this code in your observer.php
public function paymentMethodIsActive(Varien_Event_Observer $observer) {
$event = $observer->getEvent();
$method = $event->getMethodInstance();
$result = $event->getResult();
$quote = $observer->getEvent()->getQuote();
$shippingMethod = $quote->getShippingAddress()->getShippingMethod();
if($shippingMethod=="Free International Shipping"){
if($method->getCode() == 'cashondelivery' ){ // to hide this method
$result->isAvailable = false; // false means payment method is disable
}
}
}Where
cashondelivery
is payment method name. You can write any payment name like- ccsave(Credit Card (saved))
- checkmo(Check / Money order)
- purchaseorder(Purchase Order)
- banktransfer(Bank Transfer Payment)
- cashondelivery(Cash On Delivery) etc..
----------------------------------------------------
class Inchoo_Vendor_Model_Activpayment
{
public function getActivPaymentMethods()
{
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('--Please Select--')));
foreach ($payments as $paymentCode=>$paymentModel) {
$paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
$methods[$paymentCode] = array(
'label' => $paymentTitle,
'value' => $paymentCode,
);
}
return $methods;
}
}
--------------------------------------------------
Magento Observer Event on Order Place not firing
What is the correct way to set up an observer in Magento?
How do you allow the payment option to be preselected if products are free?
app\design\frontend\videocard\default\template\checkout\onepage\payment
<dl id="checkout-payment-method-load">
<?php
$methods = $this->getMethods();
$oneMethod = count($methods) <= 1;
?>
<?php
$nopay = false;
foreach ($methods as $_method):
$_code = $_method->getCode();
if($_code == 'free') {
$nopay = true;
}
endforeach;
?>
<?php
foreach ($methods as $_method):
$_code = $_method->getCode();
?>
<dt>
<?php if ($nopay == false) : ?>
<?php if(!$oneMethod): ?>
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> />
<?php else: ?>
<span><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span>
<?php $oneMethod = $_code; ?>
<?php endif; ?>
<label for="p_method_<?php echo $_code ?>"><?php echo $this->getMethodTitle($_method) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
</dt>
<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
<dd>
<?php echo $html; ?>
</dd>
<?php endif; ?>
<?php else : ?>
<?php if($_code == 'free') : ?>
<span><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span>
<?php $oneMethod = $_code; ?>
<label for="p_method_<?php echo $_code ?>"><?php echo $this->getMethodTitle($_method) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
</dt>
<?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
<dd>
<?php echo $html; ?>
</dd>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</dl>
<?php echo $this->getChildChildHtml('additional'); ?>
<script type="text/javascript">
//<![CDATA[
<?php echo $this->getChildChildHtml('scripts'); ?>
payment.init();
<?php if (is_string($oneMethod)): ?>
payment.switchMethod('<?php echo $oneMethod ?>');
<?php endif; ?>
//]]>
</script>
--------------------------
No comments:
Post a Comment