Skip to content

Instantly share code, notes, and snippets.

View dancr13's full-sized avatar
๐Ÿ˜Ž

Daniel dancr13

๐Ÿ˜Ž
View GitHub Profile
@dancr13
dancr13 / importer.php
Last active November 6, 2018 14:10
Importer to Woocomerce
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;
function getWoocommerceConfig()
{
@dancr13
dancr13 / colonesToDollar.sql
Last active September 24, 2017 20:24
This exchange colones to dollars
/* 575.747289 is the exchange rate to change. */
UPDATE ps_product_shop SET price = (price/575.747289);
/* 575.747289 is the exchange rate to change. */
UPDATE ps_product SET price = (price/575.747289) ;
@dancr13
dancr13 / Cart.php
Last active October 9, 2017 13:30
Shipping by Quantity, Copy this in root/override/classes
<?php
class Cart extends CartCore
{
/**
* This is a override of getTotalShippingCost.
* This calculates the shipping according to the quantity into the cart.
* For each product into the cart, the shipping is going to be incremental by its 50%.
* E.g: Shipping initial Cost = 2000 and there are 3 products
* So, One product 2000, two Products 2000 + 1000 = 3000, three products 3000 + 1500 = 4500 and etc.
<?php
/*
Plugin Name: Hangar plugin
Description: Hangar prueba
Version: 0
Author: Daniel Bogarin
License: GPL2
*/
class WPHangarAPi {
@dancr13
dancr13 / productos.json
Last active November 7, 2017 03:53
productos.json
[{
"sku": "GIJOE036",
"categorias": ["GI Joe", "80s", "Cartoon"],
"titulo": "Cobra Commander G.I. Joe T-Shirt",
"url": "cobra-commander-g-i-joe-t-shirt",
"pics": ["https:\/\/80stees.imgix.net\/s\/files\/1\/0384\/0921\/products\/cobra-commander-g-i-joe-t-shirt.v3.dsk.jpeg?v=1461357556&usm=18&auto=format&fit=max&h=710&w=463&"],
"desc": "This G.I Joe shirt is officially licensed by Hasbro and features a print of the Cobra logo.",
"articulos": [{
"precio": 26.97,
"descuento": 0,
<?php
require __DIR__ . '/vendor/autoload.php';
use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;
function getWoocommerceConfig()
{
$woocommerce = new Client(
name: wordpress
recipe: wordpress
proxy:
pma:
- pma.wordpress.lndo.site
config:
webroot: .
via: nginx
php: '7.0'
xdebug: true
<?php
wp_nav_menu(array(
'theme_location' => 'header-menu',
'container' => false,
'menu_class' => 'nav-list',
'walker' => new Walker_Simple_Example(),
));
@dancr13
dancr13 / gist:e4705eb5342f581ca0d86acc9a71aa57
Created February 8, 2019 20:42
DOCKER: Wordpress+mariadb+phpmyadmin
wordpress:
image: wordpress
links:
- wordpress_db:mysql
ports:
- 8080:80
volumes:
- ./wp-content/:/var/www/html/wp-content
wordpress_db:
image: mariadb
@dancr13
dancr13 / gist:33665e04e933c8b46f9180f2adc1c43a
Last active March 8, 2019 21:04
Creating a cookie with a array
<script>
function getCookie(c_name) {
if (document.cookie.length > 0) {
c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}