Jump to content

Safwen

Members
  • Posts

    36
  • Joined

  • Last visited

Profile Information

  • Location
    Tunisia
  • Activity
    Developer

Safwen's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. this is the PHP code but i don't know where to place it in AuthController.php if( Tools::isSubmit('submitAccount')) { $nom = $_POST['email']; $uploads_dir = 'img/miniatures/'; chmod($uploads_dir, 770); $tmp_name = $_FILES["image"]["tmp_name"]; chmod($_FILES['image']['tmp_name'], 770); $name = $_FILES["image"]["name"]; move_uploaded_file($tmp_name, $uploads_dir.$nom.".jpg"); }
  2. Hi guys , what i want to do is to add an input image uploader in user registration form to allow customers to upload an profil image. i added an input file in the file authentication.tpl under the birthday tag like that : <div class="control-group"> <label class="control-label" for="image_lab">{l s='Image Profile'} <sup>*</sup></label> <div class="controls"> <input type="file" name="image" id="image" /> </div> </div> i added the enctype in the form tag like that : <form action="{$link->getPageLink('authentication', true)}" method="post" id="account-creation_form" class="std form-horizontal" enctype= "multipart/form-data"> now in authController.php i want to retrieve the uploaded image and to place it under a folder named profil under the img folder and to name it with the id of the customer that will be created eg : if the id affected to the customer will be 12 the image should be placed in img/profil/12.jpg how to do that in authController.php ? where to place the code exactly ? can anyone help me please ? thank you in advance.
  3. hi, i would like to do some sql querys after i check that the insertion of a new customer to dattabase has been made. i know that it should be done on AuthController.php but there is 2 functions processSubmitAccount() and processSubmitCreate() i dont' know where should i exactly put my query. how to check that the insertion has been made ? can anyone help me
  4. Thank you Vekia i fixed it the issue was in my Class Horaire.php in the validator of my id_product <?php class Horaire extends ObjectModel { /** @var string Name */ public $horaire_debut; /** @var string Name */ public $horaire_fin; /** @var string formationdate */ public $date_day; /** @var integer seller id */ public $id_seller; /** @var integer product id */ public $id_product; public static $definition = array( 'table' => 'horaire', 'primary' => 'id_horaire', 'multilang' => true, 'multilang_shop' => true, 'fields' => array( 'horaire_debut' => array('type' => self::TYPE_STRING, 'validate' => 'isHoraireDebut', 'size' => 10), 'horaire_fin' => array('type' => self::TYPE_STRING, 'validate' => 'isHoraireFin', 'size' => 10), 'date_day' => array('type' => self::TYPE_STRING, 'validate' => 'isDateDay', 'size' => 30), 'id_seller' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), ), ); public function getFields() { parent::validateFields(); $fields['horaire_debut'] = pSQL($this->horaire_debut); $fields['horaire_fin'] = pSQL($this->horaire_fin); $fields['date_day'] = $this->date_day; $fields['id_seller'] = $this->id_seller; $fields['id_product'] = $this->id_product; return $fields; } } ?>
  5. Hi guys, i have created manually (from the sql window of my PHPMYADMIN) a new table named 'pst_horaire' like this the problem i have that where i want to insert a new line from a customized controller i have created , the insertion fails and i don't know why this is how i try to insert in the table $difference = Tools::getValue("diffdays"); for ($i=0; $i <=$difference ; $i++) { $debut = Tools::getValue("horaire_debut_".$i); $fin = Tools::getValue("horaire_fin_".$i); $date_formation = Tools::getValue("date_day_".$i); $res=Db::getInstance()->insert("horaire", array( 'horaire_debut' => 'salut', 'horaire_fin' => 'bye', 'date_day' => '2013-09-11 10:44:51', 'id_product' => 20, 'id_seller' => 21, )); if($res) echo 'ok'; else echo 'not ok'; } can anyone help me to fix this please ?
  6. i have solved that instead of that <form name= "myform" enctype="multipart/form-data" method="post" action="add_product.php"> i put that <form name="myform" id="myform" action="{$request_uri|escape:'htmlall':'UTF-8'}" method="POST" enctype="multipart/form-data"> everything is going well now
  7. yes with other inputs it works well but with input type=file i get null or an empty array . I don't know why
  8. yes it is all right <form name= "myform" enctype="multipart/form-data" method="post" action="add_product.php">
  9. it seems that the value of the input file is ignored by prestashop
  10. hi guys, i want to find the $_FILES[] values (name , size etc) of an input file field in my form it seems that Tools::getValue("image"); doesn't work when i print the result. so i have tried that var_dump($_FILES['image']); but i get nothing just an empty array. how to do that please ? thanks in advance
  11. it is not important to do it like the back office my objectif is to insert a product to the database from a simple form done in the front office . can you help me on that vekia ?
  12. Hi guys, i'am developing a module that allows multiple sellers to post products from the front office after log in. My question is how to display a form like the form of the back office that allows to add a new product or to edit it. thank you in advance.
×
×
  • Create New...