Jan
20

To DO Before Using Magento Extension

Start point is config.xml file, for example /app/code/local/Companyname/Extensionname/etc/config.xml file.
Then next step will be analyzing files. There will be 3 aspect of checking it.

REWRITES Check model/class/controller.
EVENT observes
CRON job

Rewrites => you should at least take a look into every defined model/class/controller rewrite within your config.xml file. however its important to understand what the class/method you are rewriting does and try to call its logic (if possible) via parent::nameMethod().

Event Observes=>This can be extremely dangerous. we usually tend to break these in two types.
Read the rest of this entry »

Nov
03

Magento Ajax Add to Cart

Ajax Add to Cart Magento extension enables your customers to add or remove products from the cart without any page reloads and while staying on the very same page whether it is home page, category listing page, product detail page. It works for each and every kind or product such as simple, virtual, configurable or any other type.
to Download  click here Magento Ajax Cart Extention

Sep
07

Display Cart Summary and GrandTotal In Magento

Sometime we need to display cart quantity and grand total on our website with the code below
we can easily display cart summary and cart grand total anywhere on site.

<?php
  $QtyCount = $this->helper('checkout/cart')->getSummaryCount();
  $CartTotal = $this->helper('checkout/cart')->getQuote()->getGrandTotal();
  if($QtyCount==0)
  {
    echo $this->__('Items: %s',$QtyCount);
  }
  if($QtyCount==1)
  {
    echo $this->__(' Item: %s',$QtyCount);
  }
  if($count>1)
  {
    echo $this->__(' Items: %s',$count);
  }
  echo $this->__(' Total: %s', $this->helper('core')->formatPrice($CartTotal, false));

?>

May
09

Programmatically Unsubscribe Customer

Use the code given below to unsubscribe the email.



Mage::getModel('newsletter/subscriber')->loadByEmail($emailAddress)->unsubscribe();

May
09

Display Magento Store Contact Number

To display contact number of magento store, we need to just copy and paste the code given below, where we want.



Mage::getStoreConfig('general/store_information/phone');

Mar
23

Magento In Maintenance Mode

So here is a little bit of code, that allows you and other you set to work on the site while everyone else sees its maintenance mode.

All we need to do it edit 3 lines.

Open: index.php in root and above line 57 add (remembering to edit the ‘allowed’ array to contain the IP’s you want to be able to access the site);

$ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('182.186.0.134''); // IP's that are allowed to view the site.

then change the line
if (file_exists($maintenanceFile)) {
to
if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {

Simple. Now you can access the site, while others see its maintenance mode.

Feb
02

How To Get Child Product Of Configurable Product In Magento

To get child product of configrable product. Firstly we need parent product id to load product and to get child products
we need to call getUsedProducts() function to get child products.

$product = Mage::getModel('catalog/product')->load($product_id);

$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product);

Dec
04

Opening Compare Items Page In a Nice Pop-Up In Magento

To open compare item page in modal window we need to edit file ‘sidebar.phtml’ path given below

template/catalog/product/compare/sidebar.phtml

add the following js at the end of sidebar.phtml

<script type="text/javascript">// <![CDATA[
function showCompare(url) {
    winCompare = new Window({className:'magento',title:'Compare Products',url:url,width:820,height:600,minimizable:false,maximizable:false,showEffectOptions:{duration:0.4},hideEffectOptions:{duration:0.4}});
    winCompare.setZIndex(100);
    winCompare.showCenter(true);
}
// ]]></script>

we also need to edit like

<button class="button" title="<?php echo $this->__('Compare') ?>" onclick="popWin('<?php echo $_helper->getListUrl() ?>','compare','top:0,left:0,width=820,height=600,resizable=yes,scrollbars=yes')" type="button"></button>

With

<button class="button" title="<?php echo $this->__('Compare') ?>" onclick="showCompare('<?php echo $this->helper('catalog/product_compare')->getListUrl() ?>')" type="button"></button>

Read the rest of this entry »

Nov
20

How To Display Product Custom Option On list.phtml

Some time we need to display custom option of product on category list page
to achive this task we only need to paste the code given below in your list.phtml file

$productSku = $_product->getSku();
$product = Mage::getModel('catalog/product');
$productId = $product->getIdBySku( $productSku );

$product = Mage::getModel("catalog/product")->load($productId);

$attVal = $product->getOptions();

$optStr = "";

// loop through the options
foreach($attVal as $optionKey => $optionVal) {

//$optStr .= "<br/>";

//$optStr .= $optionVal->getTitle().": ";

$optStr .= "<select style='display:block; clear:both;' name='options[".$optionVal->getId()."]'>";

foreach($optionVal->getValues() as $valuesKey => $valuesVal) {
$optStr .= "<option value='".$valuesVal->getId()."'>".$valuesVal->getTitle()."</option>";
}

$optStr .= "</select>";

}

echo($optStr ); 

Oct
31

Add a language pack In Magento store view

Creating a store view for a language is not too hard in magento follow the steps given below and you are done with it.

Step 1: Download the language pack you need and then unpack it to your Magento install folder.
It copies two folders: one goes to app\design\frontend\default\default\locale
and the other one to app\locale.

Step 2: Go to System > Configuration in your admin. On the left top corner in Current Configuration Scope dropdown box, you can see Default Config, and Main Store in English store view.

Step 3: Now let’s go and add the French store view. Under the dropdown box, there’s Manage Stores link or you can directly go to System > Manage Stores. Click the Create Store View link on top right, and type these in store view information form:
Store: Main Store
Name: French
Code: french
Status: Enabled
Sort order: 0

Step 4: Save, go back to System > Configuration. In Current Configuration Scope dropdown box, you now see there’s French store view. Click that link.
On Locale options tab on the left, uncheck the ‘use website’ checkbox then change the locale to French (France). Save.
Now you can have your website in French.

Page 1 of 912345...Last »