Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

June 17, 2015

Magento folder structure 1.9.X

Magento folder structure is different from General MVC framework.
Let take a look at the directory tree, and each folder and its usefulness:

 app: app folder is the core/heart of Magento Application and is further divided into three main folders:
code: code folder contains all our application code divided into three code pools such as core, community, and local

design: Design folder contains all the templates and layouts files for magento application

locale: This contains all the translation and e-mail template files that are used in magento application

• js: This contains all the JavaScript libraries that are used in Magento along with the prototype, varien js and any other js files.

• media: This contains all the images and media files for our categories, products and
CMS pages.

• lib: Library folder contains all the third-party libraries used in Magento such as Zend and PEAR, and other custom libraries developed by Magento, which
reside under the Varien and Mage directories

• skin: Skin directory contains all CSS files, images, and JavaScript files used by the corresponding theme.
Both the admin theme and front end theme css data reside under it.

• var: Var directory contains temporary data such as cache files, index lock files,
sessions, import/export files.
If you are using the Enterprise edition, then it holds the full page cache folders.

February 18, 2014

Remove login from phpmyadmin in wamp server or disable admin login in mysql

Get rid of phpmyadmin login 

If you want to use phpmyadmin without cookie limit and want to get rid of login credentials.

Heres is the tip for those:

Go to the wamp installation directory

C:\wamp\apps\phpmyadmin** 

** version numbers that may be different.

Find the config.inc.php and take back up of it to save for the future use.

Open config.inc.php in any text editor (i.e. notepad, notepad++)

Go to the authentication section type.
/* Authentication type */
You will find the $cfg array(mostly 3 dimensional array.).

Do change as follows:
Change the auth type value to config.
                     // $cfg['Servers'][$i]['auth_type'] = 'cookie';

$cfg['Servers'][$i]['auth_type'] = 'config';

Now speciy the user and password for same like below:

Add the following lines/params in /*Server parameters section*/ which is generally next to authentication type:

$cfg['Servers'][$i]['user'] = 'root';
  /*User name during installation*/
$cfg['Servers'][$i]['password'] = ' ';           /*Password during installtion generally blank*/
$cfg['Servers'][$i]['AllowRoot'] = TRUE;   

February 13, 2014

How to add Java Script to smarty template file

{literal}

In smarty, how can you add Javascript to template file.
You just have to use built-in-function named literal.

{literal} tags allow a block of data to be taken literally from the template file. 
Simple logic is there, {literal}{/literal} tags is not interpreted, but whatever we have written within code it will display same.

Syntax:
{literal}

/* Some java script code */

{/literal}
e.g.

<script type="text/javascript">
  function callHello() { 
alert('hello world. !!');   
   }
</script>

Cheers :).

February 11, 2014

Removing index.php from Magento URL

How to Remove .php extension from Magento URL
Here is the solution to remove magento url.

You need to enable mod_rewrite apache server.
Log in to magento admin area.
After that Select System(Probably last menu item) -> Choose Configuration.
Now from left menu panel, under General Section, select web option,
Then in Search Engines Optimization,
Set use web server rewrites to yes.
click on Save configuration to save.

Then Go to the Cache Management under System menu 
Flush magento cache and flush cache storage .
refresh and check the site.

Cherrs  :).

January 23, 2014

Yii remove index.php from URL and SEO URL tips


This one is using for removing index.php and also remove site portion from URL.

I am trying to remove index.php from the URL string for so many times. Finally i got some cases in which i want to share with you guys.


Verify mod_rewrite is enabled in your server you can check it to load php.ini file.

Just copied following code and paste into urlManager in main.php
Here's what I put under components file main.php:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
//'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
'/'=>'site/index',
'blog'=>'post/index',
'<view:(about)>'=>'site/page',
'contact'=>'site/contact',
'login'=>'site/login',
),
//'urlSuffix'=>'.html',
),

Also,
You can make your own rule to your web page need:
Here, i have changed site/login to login and site/contact to contact.
Also , post/index to blog as you can see in the rules array.

Hope this is one helps you in many ways.





January 09, 2014

Session Variables in Magento


Following are main of the session variables. 

1. First one is about getting information regardng core session data for magento.
Core Session :- Mage::getSingleton(‘core/session’) 

2. Customer session is for getting details associated with the customer data that is currently in session.
You can play with customer session data in shopping cart in the case of one page check out or another kind of. 
Customer Session :- Mage::getSingleton(‘customer/session’);

3 .Admin session gives you information regarding admin session related with admin modules and permisssions.
You have to back up your source code before using this session. This is very important. 
Admin Session :- Mage::getSingleton(‘adminhtml/session’) 

4. Shopping cart session determines that you can get info about various products in shopping cart and customer data. 
Shopping Cart Session :- Mage::getSingleton(‘checkout/session’)->getQuote() 

User defined session variables: 
How to set a session variable in Magento : 
$data = 'Hello heaven welcomes you.'; 
 Mage::getSingleton('core/session')->setMyData($data); 
OR 
Mage::getSingleton('core/session')->setData('my_data', $data); 

How to get a session variable in Magento: 
$string_data = Mage::getSingleton('core/session')->getMyData(); 
OR
$string_data = Mage::getSingleton('core/session')->getData('my_data'); 

var_dump($string_data ); 

January 06, 2014

Magento Admin Access Alternate way :: Admin Password Encryption - Decryption

Hello Everyone,

Here the tip for magento admin access.
Go to "app/code/core/Mage/Admin/Model/User.php"

Now, Comes to authenticate method around 325 line no.
You will find this code in this method.
Just comment on it.

/*if ($sensitive && $this->getId() && Mage::helper('core')->validateHash($password, $this->getPassword())) {
                if ($this->getIsActive() != '1') {
                    Mage::throwException(Mage::helper('adminhtml')->__('This account is inactive.'));
                }
                if (!$this->hasAssigned2Role($this->getId())) {
                    Mage::throwException(Mage::helper('adminhtml')->__('Access denied.'));
                }
                $result = true;
           }*/
....................................................................................................

After comment on said condition,

Just write following code before Mage::dispatchEvent('admin_user_authenticate_after', array(); 

$result = true; 
Mage::dispatchEvent('admin_user_authenticate_after', array();

You have access for admin just entering valid username.

Enjoying.

Cheers :)




October 23, 2013

Magento Product price in Custom Option on Product View Page

Go to app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php
Go to line around 60.

Just replace the foreach loop with following code.

//Code for foreach loop
foreach ($_option->getValues() as $_value) {
                $priceStr = $this->_formatPrice(array(
                    'is_percent'    => ($_value->getPriceType() == 'percent'),
                    'pricing_value' => $_value->getPrice(($_value->getPriceType() == 'percent'))
                ), false);
                
                $pro_price = $this->helper('core')->currencyByStore($this->getProduct()->getPrice(),$store,false);                
                
                $select->addOption(
                    $_value->getOptionTypeId(),
                    $_value->getTitle() . ' ( '.$pro_price.' ) ' . $priceStr . '',
                    array('price' => $this->helper('core')->currencyByStore($_value->getPrice(true), $store, false))
                );
            }

October 22, 2013

How to Check the Magento version different ways | Check Magento version

Here is the tip:

Create file getVersion.php in the root folder.


Now copy and paste following code in getVersion.php:


<?php
      include_once(‘App/Mage.php’);
      Mage::app();
      echo 'You are using magento version named:'.Mage::getVersion();
?>

Run file http://www.domain.com/getVersion.php

Check Magento version for Magento 2 website

Other numbers of ways to check Magento version of the website.
1. Using the HTTP GET Request by adding /magento_version into the domain name


http://<magento2-store>/magento_version
Copy


If your domain name is www.domain.com/magento_version it will give you Magento version and edition running on the website.

2. By third party scanners or informative websites which are as follows:

Open magescan.com and provide domain name (www.domain.com) URL
open MageReport.com (free tool allows to check status of the Magento website and provides useful results.) 
Open builtwith.com and provide the domain name (www.domain.com)


3. Command line

The following command returns the Magento version.
Command:

bin/magento --version


Enjoy.. :)

October 16, 2013

Captcha Extensions for magento


Captcha Extensions for Magento Forms


http://mydons.com/add-captcha-in-magento-customer-registration-form/


http://www.magentocommerce.com/magento-connect/Fontis/extension/1169/fontis-recaptcha

http://www.fontis.com.au/magento/extension/recaptcha

http://www.magentocommerce.com/magento-connect/outsourceonline-captcha-6034.html

https://store.i95dev.com/i95dev-captcha.html