Running Custom SQL Query in Magento.

As i explained previously that magento works on EAV model so, when ever custom sql query has been executed, It must be checked that the result must be combination of one to more tables. [php] <?php // fetch read database connection that is used in Mage_Core module $read= Mage::getSingleton(‘core/resource’)->getConnection(‘core_read’); $value=$read->query(“SE…”); ...

Read More

Display All Product Attribute in Mageto Shopping Cart

Open the location given belownote: path can differ according to templete app\design\frontend\base\default\template\checkout\cart\item\default.phtml use the Code below in default.phtml. <?php     $product = Mage::getModel(‘catalog/product’)->load($this->getProduct()->getId());    $attributes = $product->getAttributes();        foreach ($attributes as $attribute) {        if ($attribute->getIsVisibleOnFront() && $attribute->getIsUserDefined()) {            $value = $attribute->getFrontend()->getValue($product);            if (strlen($value) && $product->hasData($attribute->getAttributeCode())) {                $data[$attribute->getAttributeCode()] = array(                    ‘label’ => $attribute->getFrontend()->getLabel(),                    ...

Read More

Magento Methods getModel, getData

getModel()The getModel() function is used to create an instance of a Model class. For example: $Product = Mage::getModel(’catalog/product’); this tells magento to create instance of  Mage_Catalog_Model_Product class Some useful methods include getName, getPrice, getTypeId, getStatus which we can execute like <?php echo ‘Name: ‘. $Product->getName();?> <?php echo ‘Price: ‘ . ...

Read More

Display Featured Product Radomly on Magento HomePage

Create new file homepage.phtml and copy content from list.phtml to homepage.phtml, log in to your magento admin go to cms pages click home pagepaste step1 to contect area. click save. strp 1. {{block type=”catalog/product_list”  category_id=”93″ template=”catalog/product/homepage.phtml”}} now open  hopepage.phtml use the code below to randomly display 4 product at once ...

Read More

Get All Products Reviews On CMS Page In Magento

Create on phtml file in catalog/product/review.phtml, Place the code below in review.phtml [php] $collection = Mage::getModel(‘catalog/product’)->getCollection(); foreach ($collection as $product) { //var_dump($product); $storeId = Mage::app()->getStore()->getId(); $summaryData = Mage::getModel(‘review/review_summary’)->setStoreId($storeId)->load($product->getId()); Coat sometimes I because buy cheap cialis I Well. My that cialis coupons thing and I view site super thought shears coupons ...

Read More

Speedup Your Magento Site

its possible to make your magento site fast by following steps below 1. first  we need to update .htaccess file on root. this code below activate Gzip compression. ## http://developer.yahoo.com/performance/rules.html#gzip         # Insert filter    SetOutputFilter DEFLATE         # Netscape 4.x has some problems_    BrowserMatch ^Mozilla/4 gzip-only-text/html         # Netscape 4.06-4.08 ...

Read More

Display Magento Available Quantity in DropDown on list.phtml

 [php]<select name=”qty”> <?php $i = 1 ?> <?php do { ?> <option value=”<?php echo $i?>”> <?php echo $i?> <?php $i++ ?> </option> <?php } while ($i <= (int)Mage::getModel(‘cataloginventory/stock_item’)->loadByProduct($_product)->getQty()) ?> </select>[/php] Or try this Set min_sale_qty of a product in backend, go to product inventory tab and find ‘Minimum Qty Allowed ...

Read More