Posted: June 9th, 2011 | Author: jriggs | Filed under: magento, web | Tags: global function magento | 2 Comments »
This code will allow you to add a function that can be called from anywhere within Magento. It extends the helper class
1) Create a file named ‘Mycode.xml’ and copy it to app/etc/modules/ – it should look like this:
<?xml version="1.0"?>
<config>
<modules>
<Mycode_Function>
<active>true</active>
<codePool>local</codePool>
</Mycode_Function>
</modules>
</config>
2) Create the directory
app/code/local/Mycode/Function/etc
and then create a file named ‘config.xml’
In it copy:
<?xml version="1.0"?>
<config>
<modules>
<Mycode_Function>
<version>1.0.0</version>
</Mycode_Function>
</modules>
<global>
<helpers>
<function>
<class>Mycode_Function_Helper</class>
</function>
</helpers>
</global>
</config>
3) Create the directory
app/code/local/Mycode/Function/Helper
and then create a file named ‘Data.php’
In it copy:
<?php
class Mycode_Function_Helper_Data extends Mage_Core_Helper_Abstract
{
public function test(){
return 'works';
}
}
You can now call this function like so
<?php
echo Mage::helper('function')->test();
?>
Posted: May 29th, 2011 | Author: jriggs | Filed under: drupal, web | Tags: drupal, update, upgrade drupal 7.2 | 1 Comment »
After backing everything up…
# get the upgrade
wget http://ftp.drupal.org/files/projects/drupal-7.2.tar.gz
# uncompress it
tar xfzv drupal-7.2.tar.gz
# copy all files to my document root
cp -r drupal-7.2/. /www/.
found here
Posted: May 13th, 2011 | Author: jriggs | Filed under: html, web | No Comments »
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Blank Strict Template</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="">
<meta name="keywords" content="">
<script type="text/javascript">
</script>
<style type="text/css">
</style>
</head>
<body>
<div>
<p>blank template</p>
</div>
</body>
</html>
Download zipped html file
Posted: April 19th, 2011 | Author: jriggs | Filed under: magento, php, web | No Comments »
Add this code to:
\app\design\frontend\enterprise\<your theme>\template\checkout\success.phtml
<?php
$order_id = Mage::getSingleton('checkout/session')->getLastOrderId();
$order = Mage::getModel('sales/order')->load($order_id);
$_totalData = $order->getData();
/*linkshare vars*/
$skus = array();
$qtys = array();
$amounts = array();
foreach ($order->getAllItems() as $item) {
$skus[$item->getProductId()] = $item->getSku();
$names[$item->getProductId()] = rawurlencode($item->getName());
$qtys[$item->getProductId()] = $item->getQtyOrdered() * 1;
$amounts[$item->getProductId()] = $item->getRowTotal() * 100;
}
$order_id = $_totalData['increment_id'];
$skuspipe = implode("|", $skus);
$namespipe = implode("|", $names);
$qtyspipe = implode("|", $qtys);
$amountspipe = implode("|", $amounts);
?>
<img src="https://track.linksynergy.com/ep?mid=xxxx&ord=<?php echo $order_id ?>
&skulist=<?php echo $skuspipe ?>&qlist=<?php echo $qtyspipe ?>&amtlist=
<?php echo $amountspipe ?>&cur=USD&namelist=<?php echo $namespipe ?>">
Make sure to replace ‘xxxx’ with your own Merchant Id number
Code modified/corrected from this post .