Sunday, 6 April 2014

Remove all Customers with Reset Id in Magento.

Run Below Query in your database.please  make a backup your db 
SET FOREIGN_KEY_CHECKS=0;
-- reset customers
TRUNCATE customer_address_entity;
TRUNCATE customer_address_entity_datetime;
TRUNCATE customer_address_entity_decimal;
TRUNCATE customer_address_entity_int;
TRUNCATE customer_address_entity_text;
TRUNCATE customer_address_entity_varchar;
TRUNCATE customer_entity;
TRUNCATE customer_entity_datetime;
TRUNCATE customer_entity_decimal;
TRUNCATE customer_entity_int;
TRUNCATE customer_entity_text;
TRUNCATE customer_entity_varchar;
TRUNCATE log_customer;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;

ALTER TABLE customer_address_entity AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_datetime AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_decimal AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_int AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_text AUTO_INCREMENT=1;
ALTER TABLE customer_address_entity_varchar AUTO_INCREMENT=1;
ALTER TABLE customer_entity AUTO_INCREMENT=1;
ALTER TABLE customer_entity_datetime AUTO_INCREMENT=1;
ALTER TABLE customer_entity_decimal AUTO_INCREMENT=1;
ALTER TABLE customer_entity_int AUTO_INCREMENT=1;
ALTER TABLE customer_entity_text AUTO_INCREMENT=1;
ALTER TABLE customer_entity_varchar AUTO_INCREMENT=1;
ALTER TABLE log_customer AUTO_INCREMENT=1;
ALTER TABLE log_visitor AUTO_INCREMENT=1;
ALTER TABLE log_visitor_info AUTO_INCREMENT=1;
SET FOREIGN_KEY_CHECKS=1;

Wednesday, 26 March 2014

How to add custom field in Magento newsletter module.

Step 1 : Open file: root/app/design/frontend/your-package-name/your-theme/template/newsletter/subscribe.phtml

Add input field for ‘Name’ before ‘Email’ Field :
<input type="text" name="subscriber_name" id="subscriber_name" title="<?php echo $this->__('Name') ?>" />
 
Step 2 : Open file:  root/app/code/core/Mage/Newsletter/controllers/SubscriberController.php
A. Search:
$status = Mage::getModel('newsletter/subscriber')->subscribe($email);
Replace with:
if ($this->getRequest()->getPost('subscriber_name'))
{
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
$subscriber_name     = (string) $this->getRequest()->getPost('subscriber_name');
$subscriber->setsubscriber_name($subscriber_name);
}
$status = Mage::getModel('newsletter/subscriber')->subscribe($email,$subscriber_name);
 
Step 3 : Open file : root/app/code/core/Mage/Newsletter/Model/Subscriber.php
A. Search:
public function subscribe($email)
Replace with:
public function subscribe($email,$subscriber_name=null)
B. Search:
$this->setSubscriberEmail($email);
Add after it:
$this->setsubscriber_name($subscriber_name);
C. Search:
public function setEmail($value)
{
return $this->setSubscriberEmail($value);
}
Add after it:
public function setsubscriber_name($value)
{
return $this->setSubscriberName($value);
}
Step 4 : Open file : root/app/code/core/Mage/Adminhtml/Block/Newsletter/Subscriber/Grid.php
A. Search:
$this->addColumn('email', array(
'header'    => Mage::helper('newsletter')->__('Email'),
'index'     => 'subscriber_email'
));
Add before it:
$this->addColumn('subscriber_name', array(
'header'    => Mage::helper('newsletter')->__('Subscriber Name'),
'index'     => 'subscriber_name',
'default'   =>    '----'
));
Step 5 : Open your database.
Create a field ‘subscriber_name’ in table “Newsletter Subscriber”.
Step 6 : Clear the caches ................
 
  
 
 
 
 
 
  
 
  

Monday, 13 January 2014

After upgrade 1.7 to 1.8, ‘Place Order’ button does not work

Replace the base file the following path
app/design/frontend/default/your_theme/template/checkout/onepage/review/info.phtml
(or)
Replace the line number 81 in info.phtml
review = new Review(’<?php echo $this->getUrl('checkout/onepage/saveOrder', array('form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>’, ‘<?php echo $this->getUrl('checkout/onepage/success') ?>’, $(’checkout-agreements’));

Friday, 26 July 2013

How to remove index.php from Any URLs in Magento

find below line in .htaccess
  # These lines rewrite /index.php/admin to /admin.
     RewriteCond %{REQUEST_URI} ^/index.php/admin.*$
     RewriteRule ^index.php/admin(.*) /admin$1 [R]
  
follow below code for remove index.php
 example1= www.domain.com/index.php/affiliate/
   # These lines rewrite /index.php/affiliate to /affiliate.
     RewriteCond %{REQUEST_URI} ^/index.php/affiliate.*$
     RewriteRule ^index.php/affiliate(.*) /affiliate$1 [R]

      example2
    # These lines rewrite /index.php/articles to /admin.
     RewriteCond %{REQUEST_URI} ^/index.php/articles.*$
     RewriteRule ^index.php/articles(.*) /articles$1 [R]
   

Thursday, 27 June 2013

How to display the product price with tax in product list/view page.

Follow the steps to achieve this.
1. Sign in to Magento Admin Panel
2. Go to System > Configuration
3. Click on ‘Tax’ listed under Sales
4. Go to ‘Calculation’ and set ‘tax based on’ to ‘Shipping Origin’
5. Go to ‘Display’ and set ‘Display Cart/Order Prices’ to ‘including and excluding tax’
6. Go to ‘Display’ and set ‘Display Product Prices’ to ‘including and excluding tax’
7. Save the Configuration

Wednesday, 5 June 2013

Magento - remove trailing slash from urls

Open app\code\core\Mage\Core\Block/Abstract.php and find the getUrl() method, it should just be one line of code that returns the requested URL:


return $this->_getUrlModel()->getUrl($route, $params);
Replace that line with the following:


$return_url = $this->_getUrlModel()->getUrl($route, $params);
if ($return_url != $this->getBaseUrl() && substr($return_url, -1) == '/' && !Mage::getSingleton('admin/session')->isLoggedIn()):
    return substr($return_url, 0, -1);
else:
    return $return_url;
endif;

Monday, 25 February 2013

Magento - Editing phtml Files in Dreamweaver

Its only recently that we came across a post which has now brought me a lot of joy to our lives and made it a lot easier on the eyes. Natively dreamweaver does not recognise phtml files and so you end up living in a black and white world, which is ok except you feel like you've been living in a 1950's sid com for the last few years. However help is finally at hand and now you can finally see phtml files for what they really are and we're going to show you how to achieve the same.
First of all since we're all on PC's, the fix described is only for windows based computers. But if you do need a fix for windows you can find the fix here.
  • Step One
Documents and Settings > [user] > Application Data > Adobe Dreamweaver > Configuration > extensions.txt
Change the top line and add the PHTML
HTM,HTML,SHTM,SHTML, ... ,TXT,PHP,PHP3,PHP4,PHP5,PHTML,JSP,WML,TPL, ... ,MASTER:All Documents
And then change the third line down to look like
PHP,PHP3,PHP4,PHP5,TPL,PHTML:PHP Files
  • Step Two
Program Files > Adobe > Dreamweaver [Your Version] > configuration > Extensions.txt
Change the top line and add the PHTML
HTM,HTML,SHTM,SHTML, ... ,TXT,PHP,PHP3,PHP4,PHP5,PHTML,JSP,WML,TPL, ... ,MASTER:All Documents
And then change the third line down to look like
PHP,PHP3,PHP4,PHP5,TPL,PHTML:PHP Files
  • Step Three
Program Files > Adobe > Dreamweaver [Your Version] > configuration > DocumentTypes > MMDocumentTypes.xml
Go to line 75 and change it so it looks like below
<documenttype id="PHP_MySQL" servermodel="PHP MySQL" internaltype="Dynamic" winfileextension="php,php3,php4,phtml,php5,<strong>phtml</strong>"<br />macfileextension="php,php3,php4,phtml,php5,<strong>phtml</strong>" file="Default.php" writebyteordermark="false">; </documenttype>