Wednesday, June 1, 2011

Most Importants Links of Magento:

Most Importants Links of Magento:




Customer Activation:


Brief Description

This small extension makes it impossible for a customer to log in to magento until the account has been activated in the adminhtml interfac


URL: https://www.magentocommerce.com/magento-connect/vinai/extension/489/customer-activation





Custom Module With Custom Database Table


Thanks to member Danieln for creating this PHP script to automatically create a base module given a Namespace and Module.


URL: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/custom_module_with_custom_database_table



skip shipping method from onepage checkout :=>In Magento

skip shipping method from onepage checkout :=>In Magento

step 1: app/code/core/Mage/Checkout/Block/Onepage/Onepage.php

change the line
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
with
$stepCodes = array('billing', 'payment', 'review');

step2 : app/code/core/mage/checkout/controller/Onepagecontrollers.php

protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'shpping-method' => '_getShippingMeghtoHtml',
'review' => '_getReviewHtml',
);

to

protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'review' => '_getReviewHtml',
);


Step 3. In same page

------------------------Change this code--------------------------
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);

if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);

if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
'html' => $this->_getShippingMethodsHtml()
);

$result['allow_sections'] = array('shipping');
$result['duplicateBillingInfo'] = 'true';
} else {
$result['goto_section'] = 'shipping';
}
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
-----------------------With-----------------------
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);

if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);

if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} else {
$result['goto_section'] = 'payment';
}
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}



Step 4. app/code/core/Mage/Sales/Model/Service/Quote.php

-------------------------Change this code ----------------
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
if ($addressValidation !== true) {
Mage::throwException(
$helper->__('Please check shipping address information. %s', implode(' ', $addressValidation))
);
}
$method= $address->getShippingMethod();
$rate = $address->getShippingRateByCode($method);*/
if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
Mage::throwException($helper->__('Please specify a shipping method.'));
}
}


---------------------------With------------------------
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
}



Step: 5. app/design/frontend/base/default/template/checkout/onepage/billing.phtml

remove the code of radio button : line no 173

Step: 6. app/design/frontend/base/default/template/checkout/onepage/progress.phtml
remove the code for hide shipping method block: Your Checkout Progress

Step: 7.

Change Order tamplate which you have created
OR
Change from here:
app/locale/en_US/template/email/sales/order_new.html

Remove following code:















Shipping Information: Shipping Method:

{{var order.getShippingAddress().format('html')}}
 
 
{{var order.getShippingDescription()}}
 


>>>>>>>>>>>>>>>>>>OR<<<<<<<<<<<<<<<<<<<<<<<<<
Refer Following url:
http://www.magentocommerce.com/boards/viewthread/76049/


Thanks

Issue: Mail is not going in Correct Format when you use different OS.

Problem: Mail is not going in Correct Format when you use different OS.
Solution:


if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$eol="\r";
} else {
$eol="\n";
}
# Common Headers
$headers .= 'From: Jonny '.$eol;
$headers .= 'Reply-To: Jonny '.$eol;
$headers .= 'Return-Path: Jonny '.$eol; // these two to set reply address
$headers .= "Message-ID:<".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol;


OR
Please refer this url:
http://php.net/manual/en/ref.mail.php


$headers = "From: {$email}";