Wednesday, January 16, 2013

Country of manufacture Magento

Bonsoir,
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())
      ->addAttributeToSelect('country_of_manufacture');
  foreach ($productCollection as $p) {
$manufacture = $p->getCountryOfManufacture();
  }
Voilà tout


Tuesday, November 20, 2012

Joomla error Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in

Warning: Parameter 1 to modMainMenuHelper::buildXML() expected to be a reference, value given in /var/www/vhosts/YYYY/httpdocs/libraries/joomla/cache/handler/callback.php on line 99




To avoid this error on joomla CMS 1.5.x try to upgrade your joomla version to 1.5.26
i've juste wrote that coz i didn't find a solution on any forum just i've tried that

--> unpack joomla 1.5.26 copy it as it is (expect configuration.php at the root) and upload it on the server
Eh don't forget to remove installation folder!

Thursday, November 15, 2012

htaccess redirection .html to .php

un .htaccess pour redirection tous les .html vers. php, ça peut servir surtout lorsqu'on passe d'un site statique vers un site dynamique:


#start here
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)\.html$ http://your-website/$1.php [R=permanent,NC]
#end here


Friday, September 28, 2012

Prestashop default shop currency

When i tried to create a web site based on presta shop i encountered this problem:
After creating a currency which is TND and configured it at back office, all prices  became correct, the only problem was in the front office, all prices were displayed in (euro) currency.
I didn't found a real solution, but when i deleted all the currencies but the TND, prices in front office became correct :)
That's all.

Prestashop version
PrestaShop™ 1.4.0.1 on Apache/2.2.3 

Sunday, June 3, 2012

Proteger le repertoire d'administration joomla

Pour protèger l'accès au repertoire d'administration de joomla, il y'a plusieurs manières, des composants spéciaux, le changement des droits d'accès FTP avant et après chaque usage etc...
Une manière simple est : (Protection par cookie)
  1. Creer un repertoire dans le serveur (meme niveau que components, modules ou templates ...) juste sous la racine. Attribuez un nom un peu inhabituel au repertoire exp : (Zxw39-R)
  2. Ajouter un fichier index.php dans ce repertoire "  (Zxw39-R) "dont le contenu est:
    <?php
    $admin_cookie_code="VOTRE_CODE";
    setcookie("JoomlaAdminSession",$admin_cookie_code,time()+3600,"/");
    header("Location: /administrator/index.php");
    ?>
    VOTRE_CODE  est une chaine de caractères comme vous voulez exemple "03062012"
    3600 c'est la durée de vie de la cookie (1 Heure) (vous pouvez changer la valeur)
  3. dans le repertoire d'administration "/administrator" ajouter un fichier .htaccess dont le contenu est

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/administrator
    RewriteCond %{HTTP_COOKIE} !JoomlaAdminSession= VOTRE_CODE
    RewriteRule .* - [L,F]
  4. C'est tout maintenant pour accèder à la console d'administration tapez l'url:
    Votre_site_url/ Zxw39-RVous allez être redirigé vers l'administration
    Autrement tout accès sera non autorisé par le serveur au repertoire d'administration

    Cette idée n'est pas la mienne, je l'ai reprise parce qu'elle marche très bien.