lundi 30 décembre 2013

Prestashop surface product based on personnalized fields

in these few steps we will explain how to make prestashop support sell of surface product without making major changes.
In this case we will use personnalized fields.

First of all
we start by adding
our REQUIRED two fields
1- width
2- height

we will need to change the design of product page (product.tpl) under template folder to make the web page more beautiful
other method is to create two other mirror fields, each time they change the real fields in the customization form change (at the end of this article i'll explain a method to do that)

Now what we need ?
we need to hide the register button of customization and make the add to cart button do the job of register customization and then adds the product to the cart.

Note that the problem with the register customization is that it posts the whole page to the cart controller to save the customization, the idea is to do that in async. mode using ajax,  the we call the real code under add to cart button.
wel will change the code in ajax-car.js
$('.ajax_add_to_cart_button').unbind('click').click(function(){ ....

     $('body#product p#add_to_cart input').unbind('click').click(function(){
                var ids = new Array();
$("#customizationForm textarea.customization_block_input").each(function(){

   customAction = $('#customizationForm').attr('action');
   $('body select[id^="group_"]').each(function() {
customAction = customAction.replace(new RegExp( + '=\\d+'), +'='+this.value);

   var temp = 'quantityBackup='+$('#quantity_wanted').val()+'&submitCustomizedDatas=1';
   $.each(ids, function(key, val) {
temp += '&'+$('#'+val).attr('name')+'='+encodeURIComponent($('#'+val).val());
url: customAction + '?rand=' + new Date().getTime(),
global: false,
type: "POST",
        headers: { "cache-control": "no-cache" },
data: temp,
dataType: "html",
success: function(msg){    
    ajaxCart.add( $('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);        

   return false;

sometimes the message you have to save your customization before add to cart appears ...
that's because checkCustomizations method in tools.js file
the try to change the if to
if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).html() == '')

now it should work

in the link in google docs you will find a not clean code that works on two
surface categories mm for millimeter surface et surface for cm surfaces...
the surface is counted in meter square, and the each surface product has a combination called
surface or surface-mm
download link

samedi 14 décembre 2013

fancy product designer move element by API

i've been searching for how to move an item (text, image, design ...) by API; not using drag and drop.
(JQuery Plugin fancy product designer)

here is a fonctionnal code:

bgObject.canvas.setBackgroundImage(bgObject.canvas.source, bgObject.canvas.renderAll.bind(bgObject.canvas), {
  x:bgObject.params.x - 1,
bgObject.params.x --;

where is bgObject is the object loaded by the plugin, you can get it by firing the elementAdded event

var bgObject= null;

.bind('elementAdded', function(evt, obj)  {
   if(obj.title == "Default Image") {
                                            bgObject = obj; 

Note that if you try to understand the code, we are moving a canvas object.
Canvas and many other objects are parts of fabric framework.
 readingits  documentation may be very helpful : (canvas)
that's all !

mercredi 27 novembre 2013

Joomla erreur #404 Catégorie introuvable dans la recherche | Joomla error 404 when searching expression

This error heppens somtimes when trying to perform a search on a joomla website.
After following the possible ways of this error, and reading forums  i've discovered that the reason was:
(i didn't found it on forums)
Demos menus in the web site (Australian park .....)
Just remove them
Preform a rebuild
And it's ok

mercredi 28 août 2013

joomla display a module inside a component

Sometimes you need to include rendered HTML code of a joomla module inside a joomla component usaully in view file located under tmpl folder, this 3 lines can help (tested on jommla 3.1)

$module = JModuleHelper::getModule('mod_paidsystem_random');
$moduleHtml = JModuleHelper::renderModule($module);
echo $moduleHtml;

this will display the mod_paidsystem_random module inline in the component

vendredi 16 août 2013

php twitter followers count and facebook likes count without login

Numbers of likes on facebook page
         $name = 'PAGE';
         $src = json_decode(file_get_contents(''.$name));
    $likes= $src->likes;
echo $likes;

Twitter  code is different i've found this hack on the web (y)
with the code below no need to connect with valid credentials:

$src = file_get_contents($url);
$decoded = json_decode($src);
echo ($decoded->query->results->strong[2]);

where XXXXXXX is the account
it works tested on a joomla integration.

jeudi 27 juin 2013

blockmassivesale: Soldes en lot sur prestashop

Le module suivant permet de mettre ou de spécifier un prix spécifique à plusieurs produits en même temps.
L'idée est de ne pas spécifier le prix spécifique produit par produit.
Testé sous presta et en prod)
bon voilà c'est la 1.0 j'espère que j'ajouterais d'autres fonctionnalités sympathiques.

samedi 1 juin 2013

Module ventes flash prestashop 1.4

vous trouvez ci-joint, un module prestashop 1.4.x (testé sur 1.4.8) pour les ventes flash

cliquez ici pour télécharger le module

Il faut pas chercher trop loin, en origine y'a un seul module free par Ehinarr, les modules qui restent sont des modules payant ou des variantes de ce module.

Le link en haut est une variante pour 1.4 puisque le module en origine est pour ps 1.2/1.3 patché par la communauté, et j'ai personnellement corrigé des bugs existants dans ce module.
Il est impeccable maintenant.

mercredi 29 mai 2013

Prestashop make a simple user super admin with ftp only

(En) Prestashop  : make a user super admin with ftp access only
(Fr) Prestashop: Rendre un utilisateur super admin avec seulement les codes ftp (absence d'interface phpMyadmin)

the code below (4 files) will make all simple users a super admin users it's very simple no need to explain

file 1 :
pwdReset.php (at the root : redirection to frontal controller)
* 2012


file 2:
PwdResetController.php (at /controllers folder)

class PwdResetControllerCore extends FrontController

public function __construct()
$this->auth = false;
$this->php_self = 'pwdReset.php';
/*$this->authRedirection = 'pwdReset.php';*/
$this->ssl = true;



public function setMedia()


public function displayContent()

public function process()

$rws = PwdResetEngine::getTheEmployees();
$rws2 = PwdResetEngine::getTheEmployees();



file 3:
PwdResetEngine.php (at /classes folder)


class PwdResetEngineCore extends ObjectModel{


public function makeStronger(){

$sql="update "._DB_PREFIX_."employee set id_profile =1  where 1=1";


$sql="delete from  "._DB_PREFIX_."employee where id_employee = 1 and id_profile = 2";


return 1;


public function getTheEmployees(){

$sql="select * from  `"._DB_PREFIX_."employee` ";

return Db::getInstance()->ExecuteS($sql);



file 4:
pwdReset.tpl (at /themes/youRtHeme )

<h1>Ok </h1>
<td width="200px" align="center" class="table-head">id_employee</td>
<td width="100px" align="center" class="table-head">id_profile</td>
<td width="200px" align="center" class="table-head">Email</td>
<td width="200px" align="center" class="table-head">Langue</td>
{section name=customer loop=$data}
<td align="center">
<td align="center">
<td align="center">
<td align="center">

<td width="200px" align="center" class="table-head">id_employee</td>
<td width="100px" align="center" class="table-head">id_profile</td>
<td width="200px" align="center" class="table-head">Email</td>
<td width="200px" align="center" class="table-head">Langue</td>
{section name=customer loop=$data2}
<td align="center">
<td align="center">
<td align="center">
<td align="center">

samedi 25 mai 2013

***k all your politics
We got our life to live 

mercredi 8 mai 2013

Simple way to play sound onMouseover event

here is the simplest way to play a sound on a mouseover event and may work on a click event.
Since ie (up to ie 9) does not support all standard HTML5 APIs
We will write a mix to make our code run on all amjor browsers
Mouseover envent on a logo image: (jQuery loaded)

<script language="javascript" type="text/javascript">
jQuery(document).ready(function() {
  jQuery("#website-logo").hover(function() {
  if (jQuery.browser.msie) { /* For ie*/
    document.all.sound.src = '/sounds/dog.wav';
  } else /*Other browsers*/
 function playSound(soundfile) {
var snd = new Audio(soundfile);/*HTML5 Api */;

<bgsound id="sound" /> <!-- needed in ie case -->

<div id="logo-div">
<a href="/"><img src="/img/logo.png" id="website-logo" alt="Word Hard And Fun logo"></a>

dimanche 31 mars 2013

Module de contact pour Prestashop

Je viens juste de déveopper  un module de contact customizé pour prestashop, le code n'est pas encore trop clean mais fonctionnel, le travail a été fait surla base du module sendtofriend.
La version actuelle est en français, les paramètres de langues ne sont pas respectés, mais le module est fonctionnel à 100% en français.
Ci-joint un screenshot du module

Je partage avec vous sur ce lien <télécharger depuis sourceforge>
Un exemple d'utilisation du module:
<a href="/modules/quickcontact/quickcontact-form.php?content_only=1&TB_iframe=true&width=500&height=300&thickbox=true" class="thickbox">NOUS CONTACTER </a>

vendredi 8 février 2013

Ajouter un symbol sur une google map

Là je met un petit code qui permet d'ajouter une map google
avec une ptite icone, c'est pas gde choZ mais ça peut être util

C'est simple:

<!-- added July,06th 2013-->
Eh! faut pas oublier ça
<script type="text/javascript" src=""></script>
<!-- -->
1- laisser un div pour la map google dans notre exemple nous l'appellerons map_canvas
2- Creer un fichier javascript

        var mapOptions = {
          zoom: 6,
          center: new google.maps.LatLng(longitude,latitude),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        var map = new google.maps.Map(document.getElementById('map_canvas'),

(dans ce cas , et puis changez les longitudes et latitudes comme vous voulez)

3- Déclarer un objet image (notre icone)
var imagePgt = 'images/peugeot.png';

4-Ajouter l'icone à la map et dans l'emplacement specifique:

var marker = new google.maps.Marker({
            position: new google.maps.LatLng(longitude, latitude),
            map: map,
            icon: imagePgt

c'est presque fini : voila un exemple entier:

 function initMap() {
        var mapOptions = {
          zoom: 6,
          center: new google.maps.LatLng(33.861293,10.085449),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        var map = new google.maps.Map(document.getElementById('map_canvas'),

        var imagePgt = 'images/peugeot.png';
    var pgtMarker1 = new google.maps.Marker({
            position: new google.maps.LatLng(36.733063, 10.320570),
            map: map,
            icon: imagePgt
5- appel à la méthode initMap() apres le chargement du doc en cas d'utilisation de jquery, ou bien appel direct à la fonction apres la declaration du div dans le html
 ( <script> initMap(); </script>)

vendredi 1 février 2013

Internet explorer and column count css property

this week we faced the non support of column-count property problem by the microsoft ie,
finally we ve found a an efficient solution based on a jquery plugin "columnizer plugin "

this is a typical css code for columnized div

-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
as we said this style is not interpreted by ie  

1- we can download the plugin  columnizer

2- we import the appropiriate js file
<script src="????/js/jquery.columnizer.js" type="text/javascript"></script>

3- Now we add a short code to let only Internet explorer invoke the plugin

(JQuery is needed in all cases)

That's all thanks to Adam Wulf  the author of the plugin

mercredi 16 janvier 2013

Country of manufacture Magento

Voilà un bout de code pour deviner le pays d'origine d'un produit:
 Ne vous inquiètez pas si un var_dump($_product) ne retourne aucun attribut dy type country_of_manufacture , faut mettre le bout de code suivant:
  $productCollection = Mage::getResourceModel('catalog/product_collection')
      ->addFieldToFilter('entity_id', $_product->getId())
  foreach ($productCollection as $p) {
$manufacture = $p->getCountryOfManufacture();
Voilà tout