Skip to content

Instantly share code, notes, and snippets.

View ps_gate.php
<?php
// Is MOIP
if (isset($_POST['id_transacao'])) {
// Armazena o número do pedido
$order_number = $_POST['id_transacao'];
// Armazena o novo status do pedido
$status = $_POST['status_pagamento'];
}
View view_cart.js
function update_cart(val, zip) {
$.post(update_cart_url,{shipping_method:val,zip:$('#zip_code').val(),ajax:true}, function(data) {
$('.shipping_cost').html(data);
update_moip();
});
}
function update_moip() {
$('input[name=moip_parcel]').html('');
var value = parseFloat($('.total-value').text());
View variants
<script type="text/javascript">
<!--
var variant_map = {"TAMANHO:P":{"price":"R$ 79,00","id":"30","quantity":"4"},"TAMANHO:M":{"price":"R$ 79,00","id":"31","quantity":"8"},"TAMANHO:G":{"price":"R$ 79,00","id":"32","quantity":"8"},"TAMANHO:GG":{"price":"R$ 79,00","id":"33","quantity":"4"}};
$(document).ready(function() {
variants.toggle_variant_form();
$('.buy-btn').click(function(e){
if ($(this).hasClass('buy-btn-disabled')) {
View filters.php
<!-- The visible part in the template: -->
<div class="filters order">
<a class="main" href="#"><span class="glyphicon glyphicon-chevron-down"></span> Organizar por</a>
<ul>
<li><a class="sub" href="#order_price">Menor preço</a></li>
<li><a class="sub" href="#order_bestseller">Mais vendidas</a></li>
<li><a class="sub" href="#order_rating">Melhor nota</a></li>
</ul>
</div>
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;