How to get Magento layout outside of Magento

Magento
Get Magento Content Outiside of Magento I integreated wordpress in my magento store and I will try to get magento data in wordpress file. I want to same header in my both site magento and wordpress. I tryed to hard and finally got the solution to get any magento layout in wordpress. Below are the script to get magento layout outside of magento. [php] <?php require_once '/home/.../public_html/.../app/Mage.php'; umask(0); /* not Mage::run(); */ Mage::app('default'); // get layout object $layout = Mage::getSingleton('core/layout'); //get block object $block = $layout->createBlock('page/template_links'); /* choose whatever category ID you want */ //$block->setCategoryId(3); $block->setTemplate('page/template/links.phtml'); echo $block->renderView(); ?> [/php] Get Magento layout outside of Magento Below script to get whole magento header section with top links out side of magento. [php] <?php require_once '/home/.../public_html/.../app/Mage.php'; umask(0); /* not Mage::run(); */…
Read More

How to submit form without refreshing page with jquery and ajax

JQuery
This is very simple artical for submit HTML form data without refreshing page with the help of JQuery and Ajax. jQuery provides a rich set of methods for AJAX web development. With jQuery AJAX, you can request TXT, HTML, XML or JSON data from a remote server using both HTTP Get and HTTP Post. $.ajax(options) is the syntax of the low level AJAX function. $.ajax offers more functionality than higher level functions like load, get, and post. The option parameter takes name|value pairs defining url data, passwords, data types, filters, character sets, timeout and error functions. Below is code for HTML form. [sourcecode language="plain"] <form method="post" name="form"> <ul> <li><input id="name" name="name" type="text" /></li> <li><input id="username" name="username" type="text" /></li> <li><input id="password" name="password" type="password" /></li> <li> <select id="gender" name="gender"> <option value="">Gender</option> <option…
Read More

Display sub categories on main category page+Magento

Magento
display sub-categories instead of products on main category page+magento If you want to display Sub Categories list on main category or parent category in magento. So this artical may be help ful to you for design and display subcategories on parent category page+magento. => Copy the Category.php file from core to local. Create any directories required under app/code/local. (This is so images can be displayed) [sourcecode language="plain"] $ cp app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php app/code/local/Mage/Catalog/Model/Resource/Eav/Mysql4/Category.php [/sourcecode] => Add -addAttrbuteToSelect('image') to getChildrenCategories function [sourcecode language="plain"] public function getChildrenCategories($category) { $collection = $category->getCollection(); /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */ $collection->addAttributeToSelect('url_key') ->addAttributeToSelect('name') ->addAttributeToSelect('image') ->addAttributeToSelect('all_children') ->addAttributeToSelect('is_anchor') ->addAttributeToFilter('is_active', 1) ->addIdFilter($category->getChildren()) ->setOrder('position', 'ASC') ->joinUrlRewrite() ->load(); return $collection; } [/sourcecode] => Add or modify the category view template app/design/frontend/yourdiractory_path/default/template/catalog/category/view.phtml [php] <?php $_category = $this->getCurrentCategory(); $collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id); $rootcat = $_category->entity_id; $cat =…
Read More

Execute PHP code in .html file

PHP
Only way to execute PHP code on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html file [sourcecode language="plain"]AddType application/x-httpd-php .html[/sourcecode] Or for .htm file [sourcecode language="plain"]AddType application/x-httpd-php .htm[/sourcecode] If you only plan on including the PHP on one page, it is better to setup this way: [sourcecode language="plain"] <Files yourpage.html> AddType application/x-httpd-php .html </Files> [/sourcecode] This code will only make the PHP executable on the yourpage.html file, and not on all of your html pages. [JWD-Web-Development]
Read More

How to install magento on local server

Magento
Magento Installation | Magento Installation Process | Magento Installation On Localserver Step 1: Open php.ini file for apache C:/xampp/apache/bin/php.in Find php_curl.dll and remove comment(;) From the following line [sourcecode language="plain"]extension=php_curl.dll[/sourcecode] Same way make changes in C:/xampp/php/php.ini file Restart apache server from xampp control panel Step 2: If database connection error occurs "InnoDB Engine" Open file xampp\mysql\bin\my.cnf (Drag and Drop that file to Notepad or notepad++ program) Find code: [sourcecode language="plain"] # Comment the following if you are using InnoDB tables skip-innodb #innodb_data_home_dir = "/xampplite/mysql/" #innodb_data_file_path = ibdata1:10M:autoextend #innodb_log_group_home_dir = "/xampplite/mysql/" #innodb_log_arch_dir = "/xampplite/mysql/" ## You can set .._buffer_pool_size up to 50 - 80 % ## of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 16M #innodb_additional_mem_pool_size = 2M ## Set .._log_file_size to 25 % of buffer pool…
Read More

Check youtube video is still valid

PHP
Check youtube video is still valid using youtube's API Manytimes youtube user can decide to delete their video. So I would like to periodically run a script to check that the youtube video is still valid or not. Also, you can fine best video review apps for shopify and make better your Shopify theme. Suppose your Youtube url is : http://www.youtube.com/v/jc0rnCBCX2c So here your Youtube video Id is jc0rnCBCX2c $vid [video Id] posible format/sintax: 1. http://www.youtube.com/watch?v=[ID]&feature=…&… 2. http://www.youtube.com/watch?v=[ID] 3. www.youtube.com/watch?v=[ID] 4. youtube.com/watch?v=[ID] 5. http ://www.youtube.com/v/[ID] 6. www.youtube.com/v/[ID] 7. youtube.com/v/[ID] 8. [ID] 9. …. and any valid youtube video url [php]&amp;amp;lt;?php function checkYoutubeId($id) { if (!$data = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$id)) return false; if ($data == "Video not found") return false; return true; } ?&amp;amp;gt; [/php] http://gdata.youtube.com/feeds/api/videos/jc0rnCBCX2c if it does not exist then you…
Read More

How to call static block in magento

Magento
What is static block in magento? Static blocks can be used throughout your theme wherever you want to make small updates to a section of a page. Typical uses would be for promotional banners/callouts in sidebars or for some custom text in the middle of your home page. Static blocks can also be inserted into CMS pages or included in category pages. Creating s static block => Login in into your magento admin panel. => Navigate to CMS->Static blocks => Click Add new block => Give your block title (Title: A descriptive name to identify this block) => Give your block identifier (Identifier: The identifer will allow you to call this block from your template files or using the Magento markup tags. Typically this would be programmer friendly name with…
Read More

Magento Invalid Method Mage Catalog Model Product IsDuplicable

Magento
New version theme is not working in old version. After upgrading magento or when I design theme in magento 1.5.0.1 and use that theme in magento 1.4.2 that time my product page shows error like Invalid method Mage_Catalog_Model_Product::isDuplicable I find the solutin and its work for me. Copy your product.php file from this path: app\code\core\Mage\Catalog\Model\product.php and replace in your maegnto folder. [JWD-Magento-Development]
Read More

How to get Current page url in magento.

Magento
Get Current page url in magento or you can find catalog url using below code. With the help of this code you can easily find current page url in magento [php] <?php $current_page = ''; /* * Check to see if its a CMS page * if it is then get the page identifier */ if(Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms'): $current_page = Mage::getSingleton('cms/page')->getIdentifier(); endif; /* * If its not CMS page, then just get the route name */ if(empty($current_page)): $current_page = Mage::app()->getFrontController()->getRequest()->getRouteName(); endif; /* * What if its a catalog page? * Then we can get the category path :) */ /* * Or you can check all values * $current_page_array = Mage::registry('current_category'); * $current_page_array['url_path'] */ if($current_page == 'catalog'): $current_page = 'path-' . preg_replace('#[^a-z0-9]+#', '-', strtolower(Mage::registry('current_category')->getUrlPath())); endif; ?> [/php] Also if you…
Read More