Skip to content

Instantly share code, notes, and snippets.

@Onasusweb
Onasusweb / cheatsheet.md
Created November 20, 2020 10:17 — forked from rseon/cheatsheet.md
Prestashop cheatsheet (>= 1.5)

The most common. For me. Mostly from comments in source code.

Classes

Attribute

  • bool Attribute->cleanPositions(int $id_attribute_group) Reorder attribute position in group $id_attribute_group. Call it after deleting an attribute from a group.
  • int Attribute::getHigherPosition(int $id_attribute_group) Get the higher attribute position from a group attribute
  • bool AttributeGroup::cleanPositions() Reorder group attribute position. Call it after deleting a group attribute.

Configuration

$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@Onasusweb
Onasusweb / ImageExtractor.java
Created May 30, 2016 12:22 — forked from Daenyth/ImageExtractor.java
Java class to extract an image from an html page using a method similar to Google+'s
import java.io.IOException;
import java.net.URL;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
/**
* Given a url to a web page, extract a suitable image from that page. This will
* attempt to follow a method similar to Google+, as described <a href=
@Onasusweb
Onasusweb / Extract Url Meta data
Created May 30, 2016 12:22 — forked from Winston1029/Extract Url Meta data
Extract URL Meta data with Jsoup.
Long start = System.currentTimeMillis();
try {
Long start1 = System.currentTimeMillis();
Document doc = Jsoup.connect("http://techcrunch.com/2013/04/13/backed-or-whacked-join-together-with-the-band/").get();
Long end1 = System.currentTimeMillis();
Log.i(TAG, "CCCCC: connect" + (end1 - start1));
start1 = System.currentTimeMillis();
Elements links = doc.head().getElementsByAttribute("property"); //.getElementsByTag("meta");
end1 = System.currentTimeMillis();
@Onasusweb
Onasusweb / MySQL.php
Last active August 29, 2015 14:13 — forked from dmalykh/MySQL.php
<?php
class MySQL extends Db {
public $logRoute;
private $_cache_list;
private $_tables;
private $_enableFileCache = false;
private $_not_cached = array(
"cart"
);
<?php
require_once _PS_MODULE_DIR_ . 'sfadvancedmailer/models/Client.php';
/**
*
* @author Christophe Willemsen
*/
class SfAdvancedMailer extends Module {
<?php
if (!defined('_PS_VERSION_')) exit;
class TD_Shortcode extends Module {
protected static $initialized = false;
public function __construct() {
$this->name = 'td_shortcode';
$this->tab = 'front_office_feature';
<?php
/*header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=file.csv");
header("Pragma: no-cache");
header("Expires: 0");
*/
function friendly_url($nadpis) {
$url = $nadpis;
$url = preg_replace('~[^\\pL0-9_]+~u', '-', $url);
<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
<?php
/**
* Database Factory
* Use this factory for connections to external databases
*
* @version 1.0.0
* @author Julien BREUX <julien.breux@prestashop.com>
*/
class DbFactoryCore
{