Monday 27 August 2018

How to show category image full width on catalog page.

Go any phmtl page like 2columns-left.phtml pur after breadcrumbs below code.

$_category  = Mage::registry('current_category');
        if($_category){
        $_helper    = Mage::helper('catalog/output');
         $_imgHtml   = '';
           if ($_imgUrl = $_category->getImageUrl()) {
           echo   $_imgHtml = '<div class="category-image-container1"><div class="category-image-container-inner"><p class="category-image"><img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" /></p></div></div>';
                $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
               
            }

Monday 7 March 2016

How to change a product dropdown attribute to a multiselect in Magento

First, update the attribute input type to multiselect:
UPDATE eav_attribute SET
entity_type_id = '4',
attribute_model = NULL,
backend_model = 'eav/entity_attribute_backend_array',
backend_type = 'varchar',
backend_table = NULL,
frontend_model = NULL,
frontend_input = 'multiselect',
frontend_class = NULL
WHERE attribute_id = 'YOUR_ATTRIBUTE_ID_HERE';
 
Next, copy the attribute values from the old table to the new:
INSERT INTO catalog_product_entity_varchar ( entity_type_id, attribute_id, store_id, entity_id, value)
SELECT entity_type_id, attribute_id, store_id, entity_id, value
FROM catalog_product_entity_int
WHERE attribute_id = YOUR_ATTRIBUTE_ID_HERE;
 
Finally,  remove the old values or they will conflict with the new setup (the old values will load, but Magento will save new values to the varchar table):
DELETE FROM catalog_product_entity_int
WHERE entity_type_id = 4 and attribute_id = YOUR_ATTRIBUTE_ID_HERE;

Monday 8 June 2015

How to start with a different Customer ID in Magento?

But it will done by MySql query. Run the below query manually and
 you will get the user id starts from 200001.
 
 
ALTER TABLE customer_entity AUTO_INCREMENT = 200001;

Thursday 7 May 2015

Defer parsing of JavaScript in Magento

Copy /app/code/core/Mage/Page/Block/Html/Head.php
to
/app/code/local/Mage/Page/Block/Html/Head.php
Go to line 204 and add an defer in line 205
// static and skin javascripts

 $html .= $this->_prepareStaticAndSkinElements('<script type="text/javascript" defer src="%s"%s></script>' . "\n",
            empty($items['js']) ? array() : $items['js'],
            empty($items['skin_js']) ? array() : $items['skin_js'],
            $shouldMergeJs ? array(Mage::getDesign(), 'getMergedJsUrl') : null
        );

Friday 24 April 2015

Magento Paypal Express bug: Guest user name not save

If user name not show in admin when place an order with paypal express as guest.


Please find below file and replace code:
app/code/core/Mage/Paypal/Model/Express/Checkout.php


protected function _prepareGuestQuote()
    {
        $quote = $this->_quote;
        $quote->setCustomerId(null)
            ->setCustomerFirstname($quote->getBillingAddress()->getFirstname())
            ->setCustomerLastname($quote->getBillingAddress()->getLastname())

            ->setCustomerEmail($quote->getBillingAddress()->getEmail())
            ->setCustomerIsGuest(true)
            ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
        return $this;
    }

Friday 16 January 2015

Magento: Display currency symbol after price

Open file: /lib/Zend/Currency.php

position'  => self::STANDARD,

with:

'position'  => self::RIGHT, 

Wednesday 3 December 2014

Non WWW to WWW in magento direct and Remove index.php and of the domain

#non www to www
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]
RewriteRule ^(.*) http://www.%1/$1 [R=301,NE,L]

#remove index.php after domain name
DirectoryIndex index.php\
RewriteEngine On
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]