Thursday, May 17, 2012

magento Adding/removing values from a product custom option programmatically

it's my response in forum of magento
http://www.magentocommerce.com/boards/viewthread/265120/ 
<?php
$magePath 
'app/Mage.php';
require_once 
$magePath;
Varien_Profiler::enable(); Mage::setIsDeveloperMode(true); ini_set('display_errors'1);
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$product_ids = array(1,2,167);
$productmodel Mage::getModel('catalog/product');

foreach (
$product_ids as $product_id/**i use this two arrays for collecte value because i uses inside setData of
current option*/
$cos=array();$co=array();
$product $productmodel->load($product_id);
$options $product->getProductOptionsCollection();
if (isset(
$options)) foreach ($options as $o{
$title 
$o->getTitle();/**
this block is for changing information of specific option from collection options inside
current product
the save method for this option in end of code
*/
if ($title == "Line 1/Front"{
$o
->setProduct($product); $o->setTitle("Line 1/Ftont"); $o->setType("drop_down"); $o->setIsRequire(1);$o->setSortOrder(0);

}/**
this block for update or add information of specific value inside current option
*/
$optionType $o->getType(); //test typeif ($optionType == "drop_down"//getting collection of value related to current option$values $o->getValuesCollection(); $found false;
foreach (
$values as $k => $v//test existing of value for updateif (== preg_match("/said$/i"$v->getTitle())) //update and save$v->setTitle("morad")
->
setSku("kk")
->
setPriceType("fixed")
->
setSortOrder(0)
->
setPrice(floatval(13.0000));$v->setOption($o)->save();/**
this ligne is important i collecte all value required for normalize save function
related to current option
*/
$cos[]=$v->toArray($co);}
/**
create new value object you can use $option->getValueInstance() for working with
getSingleton
*/
$value Mage::getModel('catalog/product_option_value'); $value->setOption($o)
->
setTitle('valueiwant')
->
setSku("nn")
->
setPriceType("fixed")
->
setSortOrder(1)
->
setPrice(12)/**
this ligne is important (relation forigien key) for related this new value
to specific option
*/
->setOptionId($o->getId());$value->save();/**
this ligne is important i collecte all value required for normalize save function  
related to current option
*/
$cos[]=$value->toArray($co);}


$o
->setData("values",$cos)->save();//var_dump($cos);
}

}
}

Friday, February 24, 2012

magento path for tgz of extension already installed

you can find all tgz of all extensions already installed you can go to path

magento/downloader/.cache/community/

if you don't see .cache you must show the cached file

Monday, October 3, 2011

Monday, August 22, 2011

TUTO chapitre1: find and resolve errors in magento

many developers of magento don't know how explain their errors or find the source of bugs
for that i will writing some solutions
ok the first way you must learning the report of error or bug , if you working in production mode you should go to follder contain the file , by default magento start with production mode ,the sign of error showing in browser , you have like this message

'There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 1243095821280'

it s normal because when the site in production mode you don't want the people or client or hakers see the path of files or important information like login name or content of sensitive of xml
ok for viewing of errors you must go to this path in root folder of your site go to '\var\report' , you must see the file with name '1243095821280' in our example (see the messge error in top)
open the file and understand .
all this explain in the production mode but i think you are developer and you must work inside of develop mode
for changing to development mode you have in root .htaccess. open the file and in the first ligne add
SetEnv MAGE_IS_DEVELOPER_MODE "true"
or in root inside index.php in ligne 66
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}
after that add
Mage::setIsDeveloperMode(true);
and uncomment
#ini_set('display_errors', 1);

(i know inside '\var\log' you must find all exception and errors system but in is not praticle in real time)

(another truc in your root of site , you have a folder with name errors inside this folder you must find local.xml.sample rename to local.xml for set to "print" to show exception on screen you can inside this file add "email" to send exception on specified email)

ok i see you in futur chapitre for continue

Thursday, June 2, 2011

symfony2 twig plugin eclipse

hi all

all developer search  highlighting for all syntax 
in symfony2 twig template engine is intgreted by default 
but  if you working with eclipse pdt ; twig is not  highlighting
ok twig(symfony world php)=ninja(django world python)
ninja already have a plugin for eclipse and it s very very good for highlighting twig
for use in eclipse
goto : tab Help-> Install new software
you have a new window popup click button add


you have a new popup : in name write any name and in location you must entre this link :  http://eclipse.kacprzak.org/updates
normal click ok

 ok the new window is closed ; and you have in bottum of old window the plugin availible 
check Django Template Editor
and click next and next next .... and accept license ;ok the plugin is intalled ; and if you want restort eclipse pdt


 ok goto  tab Window->Preference->General->File Associations
ok you have this image
in top click add and entre in popup : *.twig
click bottum add : and choose Django Editor
and click ok
ok every file .twig is  highlighting with very nice color and you have autocompelation : click ctrl + space for see all

 you can edit color and templete setting



 


 


Wednesday, May 11, 2011

free download : full site created with adobe flex sdk flashdevelop or flashbuilder and inkscape

 i create this site recently
this a real demo
http://chnettoyage.com/gallery/bin/index2.html
link for download
http://chnettoyage.com/gallery/gallery.rar
description:
you have inside .rar full site created with flex sdk (flashdevelop ide)
gallery xml
cool images loader
skining created with fxg and skin class i use inskape with extention fxg exporter
cool animation
and all is open source and free
 file architictre :
in root folder (gallery) you must see file gallery.xml and assets stock of images
the folder sitew is the root folder of flex projects : inside src folder you have a main.mxml main file for start application and all file and folder require for costum skin
inside bin folder you must see .swf result and index.html
inside lib folder you have a .conf for configuration of application

i ready create a tut for custom skin go to link :
http://elmarrouani.blogspot.com/2011/05/flex-create-custum-skin-with-inkscape.html










Friday, May 6, 2011

error symfony2 userBundle 'You must at least add one authentication provider.'

for this error
'You must at least add one authentication provider.'
in pupillaire bundle userBundleur
it s very simple in you

in your configuration of security
you must change secutity: false to security: true
    firewalls:
        main:
            pattern:      .*
            security: true
            form-login:
                provider:       fos_userbundle
                login_path:     /user/new
                use_forward:    false
                check_path:     /login_check
                failure_path:   null
            logout:       true
            anonymous:    true
or declare your costum user (yes i know you must declare provider authentication)


Tuesday, May 3, 2011

flex : create custum skin with flashdevelop or gedit and inkscape extension fxg

hi this tut is for question
"how create application and custom skin flex 4 with open source soft or free soft"
ok my response "it's very very simple"
1- you must download  inkscape from this link
http://inkscape.org/download/
and install
in ubuntu you can install from terminal
why i like inkscape  : because is great tool for create vector graphic; and it's open source and free
2- you must download fxg exporter extension for inkscape  from this topic
https://bugs.launchpad.net/inkscape/+bug/625140
in this page go to response of JazzyNico topic #24 and download extension from link in top ; and for add extension:
On GNU/Linux: $HOME/.config/inkscape/extensions
On Windows (English localisation): C:\Documents and Settings\User\Application Data\Inkscape\extensions
On OS-X: /Applications/Inkscape.app/Contents/Resources/extensions

 3- create for example you custom button 
you must  resize you scene from menu file -> Document Properties
choose for example size equal a size of your button
and go to menu file->save as ->and choose .fxg
for examples graphicButton.fxg
3-open file graphicButton.fxg and delete
<mask><Group><Rect width="any" height="any"><fill><SolidColor color="#ffffff" alpha="1"/></fill></Rect></Group></mask>
if excise ; it s just after the first tag <Graphic

4- download flex sdk from site official of adobe  ; use google for search

5- for flex sdk 4 you can use a flashdevelop IDE it's free ; you can download from
http://www.flashdevelop.org/community/viewforum.php?f=11
for instructions of installation go to link :
http://www.flashdevelop.org/wikidocs/index.php?title=Installation 
note : before install you must install jre of java and .net
for linux link for highlight gedit :
http://www.flashiology.com/flash-actionscript-video-tutorials/watch/6-programming-actionscript-3-on-linux-%28developing-pure-actionscript-3-applications%29.html?task=ShowTutorial

 6- create project flex 4 : in flashdevelop
you have
folder src : and inside src you have a main application for example main.mxml
folder bin : for .swf result
folder obj : you have a configuration file
in main.mxml ; you have very basic code create with syntax mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" >
   
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:Application>  


7 - create a button : and you must have
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" >
   
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button id="button1"   />
</s:Application>

8- create a folder comp inside src and copy graphicButton.fxg ;
 paste inside comp

9- inside folder src create a file MyButtonSkin.mxml ; and copy paste
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:graphics="comp.*">
    <!-- host component -->
    <fx:Metadata>
        [HostComponent("spark.components.Button")]
    </fx:Metadata>

  
 <graphics:graphicButton  /> 
</s:Skin>

explication :
  with :<s:Skin
you open a skin tag for declare or say a flex compiler : a want this file for creating a skin class
  with :    xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/mx"
for using spark library it s new in flex 4
and use historic mxml library
   with : xmlns:graphics="comp.*" 
you say a flex sdk : i want use my custum namespace (my custom library or graphic) in our example its all file .fxg or .mxml or .as or .swc inside comp folder
with :     <fx:Metadata>
        [HostComponent("spark.components.Button")]
    </fx:Metadata> 
you specifier what component you want skin  (customise) ;  in our case is Button
with : <graphics:graphicButton  /> 
you create a dependant with content graphic of fxg and your button 

10 - ok inside file main.mxml you must declare a skin class if you want customise your button
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx" >
   
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
 <s:Button id="button1"  skinClass="MyButtonSkin" />
</s:Application>

11 -  test with :
button build or debug  in flashdevelop or ctrl+entre
or compile with terminal in ubuntu with commande mxmlc
12 - you can create interactive skin : 
over button with different color or graphic  
and out button over button with different color or graphic

13- you custumise you graphic in inkscape :
one for over and save with graphicButton.fxg
other for out save with graphicButton1.fxg


14 - for combine all inside
MyButtonSkin.mxml change content :
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:graphics="comp.*">
        <fx:Metadata>
        [HostComponent("spark.components.Button")]
    </fx:Metadata>
        <s:State name="up" />
        <s:State name="over" />
        <s:State name="down" />
        <s:State name="disabled" />
    </s:states>
 <graphics:
graphicButton   includeIn="up"/>
 <graphics:
graphicButton1   includeIn="over"/>
 <graphics:
graphicButton1   includeIn="down"/>
</s:Skin>








Tuesday, April 19, 2011

symfony2:leçon2:Doctrine2 jouer avec la generation schema data entities datafixture query puis afficher

tutoriels crier par elmarrouanni said en français
série des tutoriels pour réaliser un projet première pas vers complexité avec symfony 2 télécharger installer créer bundles entités utiliser doctrine concept injection de dépendance

cette chapitre est pour la creation de connection pour la base de donné crier schema entities
aussi les  donnés de teste (datafixtures) requete et affichage on utilisons twig


symfony2:leçon2:Doctrine2 jouer avec generation schema data entities datafixture query puis afficher from elmarrouani said on Vimeo.

Monday, April 11, 2011

example of my work maya + after effect + flash interaction

 ok this a link : http://lvscarservices.net/alcha/index.html
i like this work
i create this site for fro client in ksa
modelling rendering textuting ligthing maya mental ray
extract humain with green screen in after eefect
composition and interaction in flash with AS 3

Sunday, April 10, 2011

example of my work in animation rendering maya mental ray

all modeling ligthing textuting and rendering
compositing by elmarrouani said


example of my work in animation rendering maya mental ray from elmarrouani said on Vimeo.

models and texture from jeremy birn ligthing rendering by elmarrouani said

example of my work in animation rendering maya mental ray from elmarrouani said on Vimeo.

symfony2 les choses a savoir

quoi quoi
symfony oui
la version stable de symfony est presque  sortie
quoi de neuf
fabien dit : oublier symfony 1
cool des année d'étude et d'expérience on symfony 1 puis il ma dit oublie lol
j'oublie pas car vous sotie pas de généralité de première génération
toujours on a:
mvc
routing
yml
stratégie échappement
admin generateur
doctrine oui en version 2 est déférent  mais nous avons toujours la concept orm et abstraction de basse de donné  
console pour commande
système de cache  oui il se base sur HTTP cache mais il n est pas très difficile
les testes unitaire et testes fonctionnel ; changement pour les testes unitaire de classe lem vers  PHPUnit
i18n
d'accord pour les plus importants nouveauté:
motif injection de dépendance
Systeme de Bundle
 mais le grand changement c'est en architecture  composants pas sur eaux même
vous dit pourquoi
d'accord tous simplement  c'est pour la flexibilité et la  partage de projet entre l'équipe et aussi hors de l'équipe
on ajoutons  motif injection de dépendance et Système de Bundle on a plus de découplage et moin de coherent
on ai comme zend framework ;  mais au contraire de zend le développeur débutant  sur symfony2  ne perde pas la contrôle  de ca projet
 on va commencer dans les articles suivant une série de cours sur symfony 2 





 

 



Pourquoi apprendre a programmer en languague d'assemblage (assembleur)

livre de jour
titre : assembleur facile
auteur : Ph.Mercier 
imprimé en france par brodard et taupin 
6471E-5 - usine de la flèche (Sarthe); le 23-09-1991
pour le compte des 
nouvelles éditions marabout
D.L. septembre 1991/0099/283
ISBN 2-501-01176-7

salut voila on va parler  d'assembleur aujourd'hui j'ai un livre d'assembleur mon frère il acheter de Marché de la ferraille pour 0.3 euro ou moins édition de 1991
voila la partie a d'extraire de livre.

Pourquoi  apprendre à programmer en langage d'assemblage alors que l'on dispose aujourd'hui de puissants   outils de programmation comme DBase ou autre générateurs de programmes?
Il y a plusieurs réponses à cette question. Tout d'abord ; il faut savoir que le langage d'assemblage (on dit parfois "assembleur") est très proche de la machine sur la quelle il est utilisé ; il accès à toutes les possibilités de cette machine et il est très rapide à l'exécution . il existe sur le marché des langages de haut niveau comme le PASCAL ; c ou DBASE qui orientent leurs actions commerciales sur la rapidité d'exécution des programmes générés . Les arguments qu'ils présentent sont réels pour 90% des applications. Par contre ; pour programmer un traitement de texte ; un tableur ; un système sur d'exploitation ou même certains jeux ; il est tout à fait impensable d'envisager un autre langage que l'assembleur ; ce sont des programmes qui calculent en permanence énormément de paramètres; ainsi la moindre portion de temps ; aussi infime soit-elle ; a une importance vitale . Imaginer le traitement de texte qui vous fait patienter une demi-seconde quand vous tapez return ; le tableur qui prend plusieurs minutes pour recalculer les cellules ; un jeu où vous pouvez compter jusqu'à avant que le bombe ne percute votre avion.....
c'est tellement vrai que beaucoup de langage de haut niveau ; conscients de leurs limites ; offrent des possibilités d'interface avec l'assembleur : on pourra inclure de code assembleur au milieu d'un programme écrit en pascal ou dbase ou autre .... cette option permet  de programmer le plus efficacement possible les routines "critique" qui doivent s"exécuter très rapidement (affichage écran ; tris;...)

l'assembleur est composé d'une série d'instructions simple . le système d'exploration proposes quelques routines d'accès aux périphérique mais l'assembleur ne dispose pas l'instruction pour afficher un nombre à l'écran ; pour manipuler des chaines de caractère (concaténer ;modifier;...)  il faudra quasi tout programmer soi-même ; il est donc évident  qu'au début les programmes que vous écrivez ne sont pas  spectaculaire ....

.............
on aller vers  la page 243

la programmation en assembleur n'est pas beaucoup plus compliquée que dans n'importe quel langage pour autant que l'on soit bien organisé. le problème consiste en ce que les programmes sont général très peu lisibles et ne répondent quasi  à aucun règle ; chacun fait un peu ce qu'il veut et il en résulte qu'un programme n'est compréhensible que par qui l'a créé et encore !
Toutes sortes de théories ont été développées pour tenter d'établer des règles de programmation.
parmi ces technique ; il y en a une qui consiste a "calquer" un programme assembleur sur un langage de plus haut niveau. Ainsi ; des langage comme pascal; basic ; c  .... disposent d'une série d'instructions STANDARD qui permettent de programmer 90% des problèmes :
 IF......THEN.......ELSE 
FOR.....
WHILE.....
REPEAT.........
CASE........ OF
on pourrait donc convenir que toute série d'instructions en assembleur ayant le même fonction qu'un:
IF serait repéré par des tables IF1 ; THEN1; ELSE1;ENDIF1; l'instruction IF suivante par IF2 ;THEN2;ELSE2;ENDIF2....
FOR serait repérée par des labels FOR1.
la  programmation du problème peut donc être repérée comme pour n'importe quel langage
IF THEN ELSE
Si ax=1 Alors bx <--10
sinon
bx <--0
cx <--10
Fsi

Ce qui donne:
if1:     CMP    AX,1       ; si AX=1
      JNZ Else1
Then1:   MOV    BX,10      ;alors..
JMP   EndIf1
Else1:   MOV   BX,0      ;sinin.. 
MOV    CX,10 
EndIf1












          


 


les couleurs CMJN

extraire d'aujourd'hui 
titre de livre : Le grand poche photoshop 4
auteur : steven Moniz
année 1997

Les valeur CMJN sont des pourcentages d'encres d'impression . Une fois qu'une image a été convertie   en mode CMJN; il vaut mieux travailler dessus plutôt que de la reconvertir en rvb ; car les couleurs se décalent à chaque conversion .

التعريب
الموضوع عن الألوان الثانوية 
الألوان الأولية في الفوتوشوب = imge->mode rgb
 الألوان الثانوية في الفوتوشوب = imge->mode cmyl
قيم الألوان الثانوية هي النسب المئوية لأحبار الطباعة في حالة ما غبرت صورة ما إلى نسق الألوان الثانوية من الأفضل أن تستمر على التعديل في صورة على هذا  النسق لأنك إذا غيرتها مرة أخرى إلى مثلا نسق الألوان الأولية هذا يحدث زحزحة لقيمة اللون و هذا يحدث في كل تغير مثلا من الأولية إلة الثانوية أو العكس  
 




Symfony 2 create schema and entities from database already exist

hello it's my new tutorial for symfony 2
how i can create schema or entities from database already exist?
ok for create db with graphic assistant you can use for example mysql-workbench yes very cool tool for speed up your production ;
i know lot of developers choose inverse concept : start by creating classes of entities or schema ; then create db from one  of the two last .
ok link of tut : http://www.youtube.com/watch?v=UASGfBCzziI
and  link for  download : http://wb.mysql.com/?category_name=windows

ok now you have sql ;  import .sql with phpmyadmin or other technique

ok goto :   project symfony name->app->config->parameters.ini
and change :
[parameters]
    database_driver=pdo_mysql
    database_host=localhost  
    database_name=symfony    change with you data base name
    database_user=root      you can change with you personel name
    database_password=   ligne for your password
    mailer_transport=smtp
    mailer_host=localhost
    mailer_user=
    mailer_password=
    locale=en
    csrf_secret=xxxxxxxxxx

 we assume you already have a bundle with name yourbundle
ok goto :  project symfony folder->app->config->config.yml
and replace or configure  the name of the bundle (see last ligne) :
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        logging:  %kernel.debug%

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        mappings:
            AcmeDemoBundle: ~    replace with   yourbundle:
~ 


note: yourbundle is the name of class .php for example you have a bundle by default in package symfony ;
ok goto project symfony folder->src->Acme->DemoBundle->AcmeDemoBundle.php
AcmeDemoBundle is the name of the bundle

you can create you own bundle with commande 
point with dos in project symfony  example cd \xampp\htdocs\Symfony2 
and tap php app/console init:bundle Bundles\ yourbundle src
result : you have a new bundle in folder src
then declare you bundle in appkernel.php then declare path of namespace in autoload.php all in folder app

note:if you use windows xp ; you must declare path of php.exe in environment variable


then for create all maps of evrey table in db 
tap command 
C:\xampp\htdocs\projectprv>php app/console doctrine:mapping:import "yourbundle" yml --em=default
that because symfony use map format for create entities ;you must   symfony1.4 already have schema.yml
and goto : project symfony folder->src->Acme->DemoBundle->Resources->config->doctrine->metadata->orm
now we have your schema separete on many file with format yml 

ok for creating entities (in symfony1.4 models classes)  
tap:
C:\xampp\htdocs\projectprv>php app/console doctrine:generate:entities yourbundle
and goto :  
project symfony folder->src->Bundles->testBundle->Entity
now you see  all entities


symfony2: leçon 1:série des tutoriels en français pour réaliser un projet première pas vers complexité avec symfony 2 - chapitre1

tutoriels crier par elmarrouanni said en français
série des tutoriels pour réaliser un projet première pas vers complexité avec symfony 2 télécharger installer créer bundles entités utiliser doctrine concept injection de dépendance

cette chapitre est pour la préparation de votre poste ; et d’assemblement des outilles nécessaire ; ainsi que les manière de téléchargement de symfony2  



symfony2:leçon 1: série des tutoriels en français pour réaliser un projet première pas vers complexité avec symfony 2 - chapitre2

tutoriels crier par elmarrouanni said en français
série des tutoriels pour réaliser un projet première pas vers complexité avec symfony 2 télécharger installer créer bundles entités utiliser doctrine concept injection de dépendance

dans cette chapitre on traite deux concept en php utilisé par symfony2
namscapes pourquoi? reponse et exemple ?
méthode magique autoload avec exemple




symfony2:leçon 1:votre projet symfony 2 de première pas vers complexité-chapitre3

tutoriels crier par elmarrouanni said en français
série des tutoriels pour réaliser un projet première pas vers complexité avec symfony 2 télécharger installer créer bundles entités utiliser doctrine concept injection de dépendance

dans cette chapitre vous devez crée votre première projet sous symfony




symfony 2 :leçon 1: votre projet symfony 2 de première pas vers complexité-chpitre3 from elmarrouani said on Vimeo.