This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<?php | |
function fetchData($url){ | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 20); | |
$result = curl_exec($ch); | |
curl_close($ch); | |
return $result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable XML-RPC | |
add_filter('xmlrpc_enabled', '__return_false'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get products from within a category | |
function getCatProds($catid) { | |
$baseURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); | |
$category = new Mage_Catalog_Model_Category(); | |
$category->load($catid); // this is your category id | |
$collection = $category->getProductCollection(); | |
foreach($collection as $product) { | |
$id[] = $product->getId(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get Magento categories | |
function get_magento_categories() { | |
require_once 'app/Mage.php'; | |
Mage::app(); | |
$category = Mage::getModel('catalog/category'); | |
$tree = $category->getTreeModel(); | |
$tree->load(); | |
$ids = $tree->getCollection()->getAllIds(); | |
$categories = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// I do a lot of websites where the client would like the ease of WordPress for a blog and | |
// for regular pages, but want something enterprise level for the e-commerce portion of | |
// their site. In order to service this need, I usually setup a wordpress site as the main | |
// site and then setup Magento as a secondary site at something like example.com/shop/. | |
// Then, I use the following 'hack' in order to use WP elements from within Magento so I | |
// don't have to do twice the work and/or so the client, if they are managing the site | |
// themselves, don't have to change things in two places. For example, you can use WordPress | |
// nav menus within Magento, so that you don't have to maintain 2 menus. You can also call |