Skip to content

Instantly share code, notes, and snippets.

<?php
define('THOUSAND_SEPARATOR',true);
if (!extension_loaded('Zend OPcache')) {
echo '<div style="background-color: #F2DEDE; color: #B94A48; padding: 1em;">You do not have the Zend OPcache extension loaded, sample data is being shown instead.</div>';
require 'data-sample.php';
}
class OpCacheDataModel
{
private $_configuration;
private $_status;
<?php
class MagentoHelper {
function addSimpleProductToWishlist($productId, $customerId) {
$wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customerId, true);
$product = Mage::getModel('catalog/product')->load($productId);
$buyRequest = new Varien_Object(array()); // any possible options that are configurable and you want to save with the product
$result = $wishlist->addNewItem($product, $buyRequest);
$wishlist->save();
@phannam1412
phannam1412 / gist:73607d49dcb12fb237962d23ba534a20
Last active October 5, 2016 11:05
Ajax request with javascript
<html>
<head></head>
<body>
<script type="text/javascript">
// Set up the request.
var xhr = new XMLHttpRequest();
// Open the connection.
xhr.open('POST', 'test-ajax-request.php', true);
@phannam1412
phannam1412 / gist:f8aa3279409a9b2c2503b1fd92aafb99
Last active October 5, 2016 11:05
Ajax file upload with javascript
<html>
<head></head>
<body>
<input type="file" id="file">
<script type="text/javascript">
var fileSelect = document.getElementById('file');
fileSelect.onchange = function (e) {
// Get the selected files from the input.
var files = fileSelect.files;