Skip to content

Instantly share code, notes, and snippets.

View page.html
{% extends _layout %}
{% block content %}
<h1>{{ page.title }}</h1>
<div class="row">
<div class="col-md-12">
{{ page.content|raw }}
View Template config sample
<!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': ''},
View gist:d3b415d684390d55343a
<!-- 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' : '' }}/>
View gist:f4f4dc001e7fe79b9ce8
$('.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,
View product.html
{{ 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 Jul 28, 2014
Verify if all options are selected in looks
View look.html
<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;
View gist:c5f93abbcfd07ef55213
<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') {
View view_cart.html
<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 Aug 29, 2015
Callbacks in Xtech checkout
View gist:56c7a8835697bd1376d2
// 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.
View api_orders_test.php
<?php
class ApiTest {
private $config;
function __construct($config)
{
$this->config = $config;
}