Skip to content

Instantly share code, notes, and snippets.

{% extends _layout %}
{% block content %}
<h1>{{ page.title }}</h1>
<div class="row">
<div class="col-md-12">
{{ page.content|raw }}
<!DOCTYPE html>
<html lang="pt-BR" dir="ltr">
<head>
{{ header_code() }}
{{
template_settings({
'image:logo': {'label': 'Logotipo', 'default': ''},
'color:background': {'label': 'Cor de Fundo', 'default': '#FFF'},
'image:background': {'label': 'Imagen de Fundo', 'default': ''},
<!-- The unvisible form for submitting -->
{{ form_open(current_url(), {'id': 'filter_form', 'style': 'display:none;', 'method': 'get'}) }}
{% for prop in properties %}
{% for child in prop.children %}
<input type="checkbox" name="properties[]" value="{{ child.category.id }}" id="filter_property{{ child.category.id }}" {{ selected_properties and child.category.id in selected_properties ? ' checked' : '' }}/>
{% endfor %}
{% endfor %}
{% for option in global_options %}
{% for value in option.values %}
<input type="checkbox" name="options[]" value="{{ value.id }}" id="filter_option{{ value.id }}" {{ selected_options and value.id in selected_options ? ' checked' : '' }}/>
$('.open-modal-btn').click(function(e){
$that = $(this);
e.preventDefault();
$.ajax({
url: $that.attr('href'),
type: 'POST',
dataType: 'json',
success: function(data){
bootbox.dialog({
message: data.message,
@onefriendaday
onefriendaday / product.html
Created July 25, 2014 14:40
Show custom fields
{{ form_open('cart/add_to_cart', {'class': 'buy-btn-form'}, {'id': product.id, 'variant_id': '', 'cartkey': cart('cartkey')}) }}
{% for option in options %}
{% if option.id in product.available_options %}
{% if option.type == 'textarea' %}
<label>{{ option.name }}</label>
<textarea class="form-control" name="option[{{ option.id }}]"></textarea>
{% elseif option.type == 'textfield' %}
<label>{{ option.name }}</label>
<input class="form-control" name="option[{{ option.id }}]">
@onefriendaday
onefriendaday / look.html
Created July 28, 2014 12:54
Verify if all options are selected in looks
<script type="text/javascript">
$(document).ready(function(){
$('#look-form').submit(function(e){
var form = e;
var prevented = false;
$('.product-id:checked').each(function(){
if($(this).prev().val() == '' && !prevented){
form.preventDefault();
alert('Por favor selecione todas as opções');
prevented = true;
<div id="cielo_container">
<script>
$(document).ready(function(){
$('.cielo_options input').change(function(){
$('.cielo_show_options .form_wrap').hide();
var option = $('.cielo_options input:checked').data('show');
var debit = $('.cielo_options input:checked').data('debit');
$('#'+option).show();
if (debit == 'no') {
<div id="moip_container">
<style type="text/css">
.moip_exp_date_mm{
width: 40%;
}
.moip_exp_date_yy{
width: 50%;
}
.moip_cc_seperator{
@onefriendaday
onefriendaday / gist:56c7a8835697bd1376d2
Last active August 29, 2015 14:06
Callbacks in Xtech checkout
// Vars that needs to be set in order to work with pagseguro checkout process
var checkoutCallbacks = $.Callbacks();
var checkoutNoSubmit = false;
$('#onepage_checkoutform').submit(function(e){
// This calls the callback from ex. pagseguro.
checkoutCallbacks.fire('checkout');
// If the checkoutNoSubmit variable is set to false go and submit the form, otherwise prevent the form submit.
<?php
class ApiTest {
private $config;
function __construct($config)
{
$this->config = $config;
}