Skip to content

Instantly share code, notes, and snippets.

View PrestaEdit's full-sized avatar
👋

Jonathan Danse PrestaEdit

👋
View GitHub Profile
@PrestaEdit
PrestaEdit / composer.json
Last active December 14, 2021 16:53
PrestaShop Validator API (Example)
{
"name": "prestashop/validator",
"authors": [
{
"name": "Prestashop"
}
],
"require": {
"guzzlehttp/guzzle": "^7.0"
}
@PrestaEdit
PrestaEdit / module.php
Last active October 21, 2016 05:20
renderWidget / Use hookName as template source
<?php
/*
* [...]
*/
use PrestaShop\PrestaShop\Adapter\Cart\CartPresenter;
if (!defined('_PS_VERSION_'))
exit;
SELECT DISTINCT
p.id_product AS 'id_produit',
p.reference AS 'reference',
p.supplier_reference AS 'reference fournisseur',
pl.name AS 'designation' ,
p.id_category_default AS 'categorie par defaut',
m.name AS 'marque',
p.price AS 'prix_ht',
pl.description_short AS 'resume',
pl.description AS 'Description',
@PrestaEdit
PrestaEdit / PrestaShop_1.5.2.0.lib
Created August 16, 2015 21:28
PrestaShop_1.5.2.0.lib
<?xml version="1.0"?>
<lib>
<name>PrestaShop 1.5.2.0</name>
<type>PrestaShop</type>
<classes>
<class name="Address">
<methods>
<method type="public">__construct($id_address = null, $id_lang = null)</method>
<method type="public">add($autodate = true, $null_values = false)</method>
<method type="public">update($null_values = false)</method>
1. Folder like that:
-- Folder
--- Classes
--- FirstClass.php
--- SecondClass.php
2. A PHP file for do that:
-- Check folder Classes
--- See two .php file
---- "preg_match" all string related to a regexp (Like "doIt('[A-Z]')" for doIt('aString') or doIt('anotherString'))
@PrestaEdit
PrestaEdit / gist:272cc6af0fcc75444f80
Last active October 26, 2016 13:17
getCmpResults
/******* BEGIN: getCmpResults() *******/
public function getCmpResults()
{
$sql = 'SELECT *, "category" as type
FROM (
SELECT
queryCmp.sFilename as new_name, queryCmp.sFilePath as path, queryCmpFinal.id_category, "" as id_product, "" as id_feature_value, queryCmpFinal.id_lang, queryCmpFinal.category_name as old_name, "" as field, "" as value,
CASE WHEN queryCmp.sFilename is null THEN "delete"
WHEN queryCmpFinal.category_name is null THEN "create"
WHEN queryCmp.sFilename <> queryCmpFinal.category_name THEN "update"
@PrestaEdit
PrestaEdit / gist:5b896381c9de168c7f30
Created January 21, 2015 09:28
Datepicket: z-index
$(".datepicker").datepicker({
prevText: '',
nextText: '',
dateFormat: 'yy-mm-dd',
beforeShow: function() {
setTimeout(function(){
$('.ui-datepicker').css('z-index', 99999999999999);
}, 0);
}
});
On obtient les données contenues dans le fichier "01. Datas".
On ne sait pas si les 4 tableaux (object_type_1, object_type_2, ...) seront ou non remplis.
On ne sait pas le nombre de données contenues par tableau.
On souhaite combiner les données (critères) pour obtenir l'ensemble des combinaisons possibles en les associant.
Exemple illustré de résultat: 03. Combinations
@PrestaEdit
PrestaEdit / PrestaShop - Module dashboard
Last active August 29, 2015 14:12
PrestaShop - Module dashboard
A few new variables are necessary for a proper dashboard module:
$this->push_filename: the directory where your push data should be stored.
$this->allow_push: a boolean indicating whether your module should have data be pushed to it. or not.
$this->push_time_limit: the numbers of seconds between two data pushes.
PrestaShop 1.6 implements several new hooks dedicated to dashboard modules:
dashboardData: how you want your data to be handled.
dashboardZoneOne: enables you to display your content in the left column of the dashboard zone.
dashboardZoneTwo: enables you to display your content in the central column of the dashboard zone.
@PrestaEdit
PrestaEdit / gist:fd0d4188eaab1aa26172
Created December 23, 2014 09:32
Supprimer le dernier caractere d'une chaine
substr($string,0,-1);