Archive for March, 2011

Some Common Fixes of Magento

  1. I need to change the url that my site is defaulted to
    1. in phpmyadmin go to table core_config_data and edit base url fields to what you want
  2. A variety of Magento issues can be resolved by deleting cache
    1. to easily delete cache go to the /var folder and delete the /cache folder
  3. How to setup a Contact Us Page
    1. Paste this into a CMS page
      1. <!– CONTACT FORM CODE BEGIN–>
      2. {{block type=’core/template’ name=’contactForm’ template=’contacts/form.phtml’}}
      3. <!– CONTACT FORM CODE END–>
  4. How to Change the database a Magento Install is pointing to
    1. go to app/etc/local.xml
    2. edit the information on this page, save and upload

for more magento tutorial visit: http://blog.free-extension.com/

Advertisements

How To Setup Google Adwords Conversion Tracking in magento

Today One of  my  project i have added google  adwords. So i want to share this to everyone. this is very simple only two steps

One Step-01:

open this file

/app/design/frontend/default/yourskinname/template/checkout/success.phtml

then paste this code in the bottom of success.phtml file


<?php
 $order_details =  Mage::getModel(‘sales/order’)->loadByIncrementId(Mage::getSingleton(‘checkout/session’)->getLastRealOrderId());
 $adwords_saleamt = $order_details->subtotal;
 ?>

then login into google account

Under the “Reporting’ tab, click on “Conversions” and follow the steps to get the code that you’ll also need to add to the success.phtml page. It will look something like this:


<!– Google Code for Sale Conversion Page –>
 <script type=”text/javascript”>
 <!–
 var google_conversion_id = 0987654321;
 var google_conversion_language = “en”;
 var google_conversion_format = “3″;
 var google_conversion_color = “ffffff”;
 var google_conversion_label = “KFKFKFKFKFKF”;
 var google_conversion_value = 0;
 if (<?php echo $adwords_saleamt; ?>) {
 google_conversion_value = <?php echo $adwords_saleamt; ?>;
 }
 //–>
 </script>
 <script type=”text/javascript” src=”https://www.googleadservices.com/pagead/conversion.js”>
 </script>
 <noscript>
 <div style=”display:inline;”>
 <img height=”1″ width=”1″ style=”border-style:none;” alt=”"  src=”https://www.googleadservices.com/pagead/conversion/0987654321/?value=150&amp;label=KFKFKFKFKFKF&amp;guid=ON&amp;script=0″/>
 </div>
 </noscript>

now paste this getting code in the bottom of success.phtml page.

that okay and it is finished

 

for more magento tutorial visit: http://blog.free-extension.com/

Selecting data from database using Magento

<div>
<div>
<pre>// display all regions defined for the United States
$sql = "SELECT * FROM directory_country_region WHERE country_id='US'";
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
foreach ($connection->fetchAll($sql) as $arr_row) {
	echo $arr_row['default_name'];
}</pre>
</div>
</div>

for more magento tutorial visit: http://blog.free-extension.com/

Inserting Data in magento using raw PHP

<div>
<div>
<pre>// insert a new US State into the region table
$sql = "INSERT INTO `directory_country_region` (`region_id`,`country_id`,`code`,`default_name`) VALUES (NULL,'US','XX','New US State')";
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
$connection->query($sql);</pre>
</div>
</div>

for more magento tutorial visit: http://blog.free-extension.com/