Skip to content

Instantly share code, notes, and snippets.

@onefriendaday
onefriendaday / settings.json
Created January 23, 2015 19:03
Example to overwrite and add new language strings in xtechcommerce
{
"template_settings": {
"group:general": {"label": "General"},
"image:logo": {"label": "Logo", "default": ""},
"text:instagram_hashtag": {"label": "Instagram Hashtag", "default": "hashtag"}
},
"lang": {
"post_on_instagram": {"en": "Post on instagram with", "de": "Poste auf instagram mit", "pt": "Poste sua foto com a hashtag"},
"hi_user": {"en": "Hi {user}", "de": "Hallo {user}", "pt": "Oi {user}"},
"hi_visitor": {"en": "Hi visitor", "de": "Hallo Besucher", "pt": "Oi visitante"},
<?php
class ApiTest {
private $config;
function __construct($config)
{
$this->config = $config;
}
@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.
<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 / view_cart.html
Last active December 28, 2023 23:01
Pagseguro checkout transparent
<script type="text/javascript" src="https://stc.pagseguro.uol.com.br/pagseguro/api/v2/checkout/pagseguro.directpayment.js"></script>
<script type="text/javascript">
var paymentModule = 'pagseguro_app';
checkoutCallbacks.add(pagseguroCheckout);
function pagseguroCheckout() {
if ($('input[name=module]').val() == paymentModule) {
<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') {
@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;
@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 }}]">
$('.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,
<!-- 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' : '' }}/>