dimanche 23 mars 2014

Module JCounter, visits counter for joomla

Here is JCounter module, a visits counter for joomla 2.5/3.x.
You must unzip file first and install the two components (plugin then module) in order to use it.

Why plugin ?
When webmaster decide to disable this module on some web pages for design reasons or other, plugin continue to increase visits number, ever module is disabled on that page.

 Download link for joola 2.5 and joomla 3.x

Thanks for your suggestions

mardi 11 mars 2014

Merge Two prestashop web sites into one multi shop website (ps 1.5.x)

Let's start by pre-conditions
www1 and www2  are two websites using ps 1.5.x
=> then we have two domains (or domain and subdomain ), 2 databases and 2 prestashop working folders.

how merge ?

1- login on BO of www1
2- Activate multishop support (preferences-> generales) (may be translated) and register
3- Now may see a new menu item "multi-shop" in advanced parameters menu.

now ps is ready to work on multishop  mode

4- copy the theme of www2 in the themes directory of www1
    => if the theme of www2 (the second web site) has the same name as the first one, you must change its name then (let say 'theme2')

5- Now enter the menu item multi-shop (step 3)

you will see at the left a tree but with only one item (the name of www1)

6- Click add a shop
  i- enter the name of your site (www2)
  ii- let the two combos as they are
  iii- choose the theme (step 4 normally)
   you may then choose a least one category (default) from the tree of categories
 iv- import data ? no

Now we have to link our shop to its  url
7- Click add link
 enter web site surl of site www2 (exp: www.mysite2.com) in both http and ssl modes

8- Don't forget to activate url rewriting !
(preferences -> SEO and URLs )

Great now it will not work surely :)

9- What's the problem ?
We are searching to merge data and files => one BO (back office) and one global folder containing the two sites.
In Cpanel /plesk/etc ....
www1 -> xxx/public_html/www1
www2-> xxx/public_html/www1

samedi 15 février 2014

Prestashop The database selection cannot be made.

when migrating prestahsop from one web site to other 'The database selection cannot be made.' error happened... although my user had ALL PRIVILEGES 
privs ...
granting explicit privilerges to my user (select , insert, duplicate etc ...) solved the problem.

mercredi 8 janvier 2014

Prestashop create admin controller with back office overload

this post talk about the implementation of admin controller in prestashop and tpl file, in cases we are not using standard CRUD operations on database tables via dao models(see ObjectModel mother class)
if your are interested by the standard way (in major cases, this article can help you)
if your template does not meet with usual templates (list, form, toolbar ....)
you can :

1- create your tpl file
2- put it in admin/themes/the_theme/template

3- set the template at the constructor by wrting:

    public function __construct() {
        $this->template = 'your____tpl.tpl';
you can see the source of adminController
it may be helpful

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(this.id + '=\\d+'), this.id +'='+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