Skip to content

Instantly share code, notes, and snippets.

View michaelhjulskov's full-sized avatar

Michael Lind michaelhjulskov

  • Michael Lind
  • Denmark
View GitHub Profile
@michaelhjulskov
michaelhjulskov / google-point-field-widget.html
Last active May 11, 2018 08:45
django-map-widget form extension that finds restaurant from name and city field values - using google api PlacesService
{% extends "mapwidgets/google-point-field-widget.html" %}
{% load i18n %}
{% block extra_javascript %}
$(document).ready(function() {
if (typeof map_widget_autofill == 'function'){
map_widget_autofill(widget);
}
});
{% endblock %}
@michaelhjulskov
michaelhjulskov / templates-form_card.liquid
Last active January 15, 2016 16:54
Quickpay form fix autocomplete bug - if you use this bug fix you will link to https://www.dyrefoder.dk
<div id="payment_details" class="col-md-8">
{% include 'form_error' %}
<form method="post" autocomplete="off" action="{{ model.form_action }}">
<dl class="dl-horizontal">
<dt>{{ lang.form.card.card_number }}:</dt>
<dd><input type="text" name="card_number" id="card_number" ></dd>
<dt>{{ lang.form.card.expiration }} (mm/yy):</dt>
<dd>
<input type="text" name="month" size="2" maxlength="2" id="month" >
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
<?php
// Put here: override/classes/controller/FrontController.php
class FrontController extends FrontControllerCore
{
public function display()
{
Media::addJsDef(array(
'str_lang_impossible_add_to_cart' => Tools::displayError('Impossible to add the product to the cart.'),
'str_lang_error_unable_to_delete_product' => Tools::displayError('ERROR: unable to delete the product.'),
@michaelhjulskov
michaelhjulskov / ajax-cart.js
Last active August 29, 2015 14:24
improve alert errors prestashop
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
@michaelhjulskov
michaelhjulskov / FrontController.php
Last active May 21, 2018 14:04
Add Canonical tag's to Prestashop
<?php
// Feel free to copy IF you create a href link that point to http://www.dyrefoder.dk from your google indexed website
// Thank you
// Michael Hjulskov
// www.dyrefoder.dk
class FrontController extends FrontControllerCore
{
public function init()
{
@michaelhjulskov
michaelhjulskov / Media.php
Created May 6, 2015 13:07
override Media to make google adwords conv tracking work
<?php
// Michael Hjulskov - added this to fix issue with Google Adwords conversion tracking code
// REMEMBER TO ADD data-keepinline="true" to the order-confirmation.tpl to avoid javascript to get broken
Class Media extends MediaCore
{
public static function deferScript($matches)
{
if (!is_array($matches))
{* Michael Hjulskov Bing Ads conversion tracking *}
{literal}
<script data-keepinline="true">(function(w,d,t,r,u){var f,n,i;w[u]=w[u]||[],f=function(){var o={ti:"4039111"};o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")},n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function(){var s=this.readyState;s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)},i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)})(window,document,"script","//bat.bing.com/bat.js","uetq");</script><noscript><img src="//bat.bing.com/action/0?ti=4039111&Ver=2" height="0" width="0" style="display:none; visibility: hidden;" /></noscript>
<script data-keepinline="true"> window.uetq = window.uetq || [];
window.uetq.push({ 'gv': {/literal}{$total_paid|escape:'htmlall':'UTF-8'}{literal} });
</script>
{/literal}
{* END Michael Hjulskov Bing Ads conversion tracking *}
@michaelhjulskov
michaelhjulskov / OrderConfirmationController.php
Last active August 29, 2015 14:20
make total_paid available on confirmation tpl page
<?php
/* Michael Hjulskov
*/
class OrderConfirmationController extends OrderConfirmationControllerCore
{
public function initContent()
{
parent::initContent();
$order = new Order($this->id_order);
@michaelhjulskov
michaelhjulskov / ManufacturerController.php
Created February 12, 2015 08:40
prestashop cleanurls - added change so that manufacturers with "&" in name will not create issue
<?php
/*
* 2013 Ha!*!*y
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* It is available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
*