Add code

Saturday 23 January 2016

Magento - Proceed to Checkout button location in theme

Open this path in your root directory:

public_html/app/design/frontend/base/default/template/checkout 
/onepage/link.phtml

Here, you can find the following code:


<?php if ($this->isPossibleOnepageCheckout()):?>
    <button type="button" title="<?php echo Mage::helper('core')->
 quoteEscape($this->__('Proceed to Checkout')) ?>
   " class="button btn-proceed-checkout ban-checkout 
<?php if ($this->isDisabled()):?> 
    no-checkout
<?php endif; ?>"
<?php if ($this->isDisabled()):?> 
     disabled="disabled"
<?php endif; ?> 
    onclick="window.location='<?php echo $this->getCheckoutUrl() ?>';">  
      <span>
        <span>
          <?php echo $this->__('Proceed to Checkout') ?>
        </span>
      </span>
  </button>
<?php endif?>
 

What are “magic methods” in Magento?

Magento uses :

__call(), __get(), __set(), __uns(), __has(), __isset(), __toString(), __construct(), etc. magic methods.

You can find more details inside class Varien_Object
For more information about magic methods:


http://php.net/manual/en/language.oop5.magic.php

How to run Custom Mysql Query in Magento?

 Magento uses Zend framework in very standard manner . It uses singleton methodology to access database.Like many other standard frameworks Magento also uses the concept of ORM (Object Relation Model) approach. To access the database Magento uses resource model where each magento model is divided into two categories
1. Active Record type
2. EAV (Entity Attribute Value) Model
With this resource model we can manipulate the data from our database.
But still if we want to run our own custom mysql query Magento provides a way to do this also. Here are the way to do


Because we need to read the data then we will get connection for core_read.
Suppose you need to insert some data into database then you need to take core_write.

$db = Mage::getSingleton('core/resource')->getConnection('core_read');
//Write your mysql query here
$result = $db->query("SELECT * FROM customerhistory WHERE customer_id = ".$customer->getId()." AND status <> 0 ORDER BY created_time DESC LIMIT 0,100");
//After running check whether data is available or not
if(!$result) {
echo 'No data found';
}
else
{
//Here we are fetching the data
while ($row = $result->fetch(PDO::FETCH_ASSOC))
{
echo $row["content"];
}
}

What Are Blocks in Magento?

In the Magento architecture, a "Block" is one of the first class elements in the structure of Magento layouts. Every page in Magento is decorated by the "Layouts" file and the content is filled up by the "Blocks" of the different modules. Magento blocks are a really powerful and flexible way to plug­ your content into the already existing layouts. On the other hand, you could also use layout XML files to easily remove or Reposition any existing blocks.
We could say that "Structural Blocks" are the containers holding the "Content Blocks". Structural blocks themselves don't have any actual content to display, but they in turn display the content blocks at the end. As the name suggests, they're used to structure the content of the whole page.
For example, "Header", "Footer", "Left" and "Right" are structural blocks in Magento. "Content blocks" are assigned to the different structural positions of the layout of the Magento page, which in turn displays the actual content of the content blocks.
"Content Blocks" are the real fire power, generating the actual content for the display. As we've just discussed in the previous section, you need to assign the content block to one of the structural blocks for the front­-end display. There are some other ways which allow us to insert the content blocks using short codes, but we'll see more on that later.
Content blocks can be of any form, from a simple static content block to a list of the most recent products on the home page! In fact, the majority of the content is generated by the content blocks spread all over the different modules in Magento.
We're going to develop a very basic custom Magento module for the development of our custom block. Our custom block will be a simple block displaying the most recent products available in the store.
I assume that you're familiar with the basic structure and conventions of the Magento module files. Now, let's see the file structure we'll need to implement for our custom block.
  • app/etc/modules/Envato_All.xml: It's a file used to enable our custom module.
  • app/code/local/Envato/Recentproducts/etc/config.xml: It's a module configuration file.
  • app/code/local/Envato/Recentproducts/Model/Recentproducts.php: It's a model file which provides the array of most recent products.
  • app/code/local/Envato/Recentproducts/Block/Recentproducts.php: It's the main block file for our custom block.
  • app/design/frontend/default/default/template/recentproducts/recentproducts.phtml: It's a template file which contains the XHTML-related stuff.

How To Add Lightbox To Magento Theme.

Steps To Add Lightbox To Magento Theme (Prerequisites)

Following are the steps to add Lightbox to your Magento Theme

Download Lightbox from here :

 Make a directory called /lightbox under /skin/frontend/default/default/js/ and copy the entire lighbox code under that directory. Once done, your directory will look like /skin/frontend/default/default/js/lightbox (all code under this directory)
    copy the lightbox.js under /magento/js/lightbox (create a folder under js directory and name it lightbox). If you installation is under root directory then copy it under /root/js/lightbox
    Now, you should copy the lightbox.css to /skin/frontend/default/default/css directory.
    Create a folder called lightbox under /skin/frontend/default/default/images. Your directories for images will finally look like /skin/frontend/default/default/images/lightbox. Copy all the images from source lightbox directory here.

Wednesday 13 January 2016

Download Magento files.

Magento Community Edition : 

Here you can get the all data about Magento download with latest versions, Release archieve and You can learn how to get starts with magento.

https://www.magentocommerce.com/download


Hope you got.

Accordion tabs in magento For layered navigation

Hi ,
In this blog I’m going to explain you how to create accordion tabs in magento for layered navigation as displayed below for attributes.


Just navigate to your layered navigation file as shown:

app/design/frontend/default/{your folder}/template/catelog/layer/view.phtml


Then open that that file & paste the following jquery script at the end of the page:



<script>var $j= jQuery.noConflict();// no conflict method
$j (document).ready(function(){
$j("#narrow-by-list > dt").click(function(){
if(false == $j(this).next().is(':visible')) {
$j('#narrow-by-list dd').slideUp(300);
}
$j(this).next().slideToggle(300);
});
$j('#narrow-by-list dd').hide();
$j('#narrow-by-list dd:eq(0)').show();
});
</script>
 
 
NOTE: 
 
#narrow-by-list is the id used in that file( <dl id=”narrow-by-list“>).
 If you used different id’s, replace this with your id and save the 
file. Refresh the cache and reload the browser to see the results. Use 
no-conflict method in magento. It is a good practice to avoid javascript
 conflicts in the page.

Magento install error - Exception printing is disabled

Here is a known error which can occur when installing Magento:

There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: XXXXXXX

Here is the solution:
  1. Navigate to the "errors" folder.
  2. Change local.xml.sample to local.xml
  3. You should now see a new list of crazy errors all over the Magento page - this is okay.
  4. Open magento/lib/Zend/Cache/Backend/File.php and look for:  
     protected $_options = array(
    'cache_dir' => 'null',   
  5. Change it to: 
     protected $_options = array(
    'cache_dir' => 'tmp/',  
  6. Save it.
  7. Now the final step is to go create a tmp folder in the root Magento folder.
  8. That's it.

Magento Files and Folders Structure

Learn more about the different files and folders Magento needs to operate :

This part of the Magento tutorial will provide detailed information regarding the Magento's default files and folders structure.

The files and folders included in the main directory are as follows:
  • .htaccess - contains mod_rewrite rules, which are essential for the Search Engine Friendly URLs. There you can also find standard web server and php directives that can improve your web site performance;
  • .htaccess.sample - this is a backup of the .htaccess file. If you modify .htaccess it can be used in order to get the default settings;
  • 404 (directory) - The folder stores the default 404 template and skin for Magento;
  • app (directory) - This folder contains the modules, themes, configuration and translation files. Also there are the template files for the default administrationtheme and the installation;
  • cron.php - a Cron Job should be set for this file. Executing of the file on a defined time period will ensure that the complicated Magento caching system will not affect the web site performance;
  • downloader (directory) - This is the storage of the web downloader files. They are used for the installation and upgrade of Magento through your browser;
  • favicon.ico - the default favicon for Magento. A small icon that is shown in the browser's tool bar once your web site is loaded;
  • index.php - the main index file for Magento;
  • index.php.sample - A backup of the default index file. It can be used to revert the changes in a case of a index.php modification;
  • js (directory) - Contains the pre-compiled libraries of the JavaScript code included in Magento;
  • lib (directory) - The Magento core code is located in this folder. It contains the software's PHP libraries;
  • LICENSE_AFL.txt - The Academic Free License under which the Magento software is distributed;
  • LICENSE.txt - The Open Software License under which the Magento software is distributed;
  • media (directory) - This is the storage of the Magento media files - images out of the box, generated thumbnails, uploaded products images. It is also used as a container for importing images through the mass import/export tools;
  • mage (in versions older than 1.4.2.0 this tool was called pear) - The file controls the automatic update through the downloader script and SSH It handles the update of each individual Magento module;
  • php.ini.sample - This file contains sample php directives that can be used in order to modify your PHP setup. If you want to alter the default setup edit the file and then rename it to php.ini;
  • pkginfo (directory) - Contains files with information regarding the modules upgrades' changes;
  • report (directory) - This folder contains the skin of the Magento errors reports;
  • skin (directory) - There are located the themes files - images, JavaScript files, CSS files, Flash files. Also there can be found the skin files for the installation of skins and administration templates;
  • var (directory) - Cache, sessions, database backups, data exports and cached error reports can be found in this directory;
If you want to modify an existing template or set a new one you should know that the template files are separated in 3 folders : /app/design/frontend/default/YOUR_TEMPLATE_NAME/layout/ - Contains the .xml files that define which modules should be called by the template files and loaded in defined areas on the site
  • /app/design/frontend/default/YOUR_TEMPLATE_NAME/template/ - Contains files and subfolders that structure the final output for the users using the functions located in the layout/ folder
  • /skin/frontend/default/YOUR_TEMPLATE_NAME/ - Contains the CSS, images, JavaScript and Flash files related to the template

How To Configure Magento with SSL

Find out the easiest way to setup Magento with SSL

The private SSL certificate is an important upgrade to your website. The basic function of an SSL is to encrypt all communication between the browser and the server, ensuring that all data goes through a secure (HTTPS) connection. An SSL certificate is a necessity when you want to operate an online shop and process the sensitive customers data through your software. It helps you gain your clients' trust and increase your web site's search engines rank. You can purchase a private SSL from the  
SiteGround SSL Certificate page.

To configure Magento to work with your SSL certificate, first you need to login to your admin area and go to System -> Configuration.




Next, click on the Web link under the General tab in your left menu.


On this page, you will see many options that you can configure. However, focus only on the Secure tab. In it, make sure that you've set the Use Secure URLs in Frontend and Use Secure URLs in Admin to yes. Doing this will make your Magento application work with SSL for those parts of your site.

 That's it, your Magento store is now configured to work over SSL!

How To Magento CMS Tutorial

How to create and manage pages in Magento

In order to manage your web site pages you need to navigate to the CMS section in the Magento admin area. Click on the Manage Pages link in order to proceed with the pages modification.

You can edit a page by clicking on it. The Edit Page will open the window below:


You can modify this page to your preference.

Tuesday 12 January 2016

How To Reset Admin Password in Magento

You can reset your Magento administrative password directly through the database related to your website application. You can access the database through cPanel -> phpMyAdmin tool.
Once you have opened the phpMyAdmin tool choose the corresponding database* from the dropdown menu on the left side. After that click on the SQL tab in order to be able to execute the following MySQL query:


UPDATE `admin_user` SET `password` = MD5('NEWPASSWORD') WHERE `username` = 'ADMINUSERNAME';
 
Execute the query and your new password will be set.
 
*If you are not sure exactly which database is related to your website you can find its name inside the following file:
~/app/etc/local.xml
You can open the file through cPanel -> File manager and search for the following line:
1
<dbname><![CDATA[user_magedatabase]]></dbname>
 
 

Magento : 404 error is showing admin page

Hello, Sometimes we may get the error on admin page once done with the Magento installation. In that scenario, we have to do the following: ...