Jump to content

Does this exist in prestashop (front end user cropping)


User1234567891

Recommended Posts

I have looking through the forum and in the add ons shop, but I did not come across it.

but maybe I am looking with the wrong terms.

 

I am looking for something like this:

 

http://www.nikkel-ar...d-on-white.html

 

That front end users are able to enter size en then select which part of the image will be used.

 

If it does not exist, is there anyone out there who could built this?

 

Thanks!

Link to comment
Share on other sites

yes i write an module to save my data into database and show in backoffice:

 

<?php

class SaveVariables extends Module
 {

 public function __construct()
   {
   $this->name = 'savevariables';
   $this->tab = 'Test';
   $this->version = 1.0;
   $this->author = 'ramin sarmadi';
   $this->need_instance = 0;

   parent::__construct();

   $this->displayName = $this->l('savevariables');
   $this->description = $this->l('Save Variables on database');
   }

 public function install()
   {
   if (parent::install() == false OR !$this->registerHook('orderConfirmation') OR !$this->registerHook('adminOrder'))
  return false;
   return true;
   }

   public function hookOrderConfirmation( $params )
 {
   global $cookie;
   $id_order = $params['objOrder']->id;
   $x = $cookie->x;
   $y = $cookie->y;
   $w = $cookie->w;
   $h = $cookie->h;
   $wwr = $cookie->wwr;
   $hwr = $cookie->hwr;





if(isset($_COOKIE["imagename"]))
{
$image_name = $_COOKIE["imagename"];
Db::getInstance()->Execute
("
INSERT INTO `variables` (`id_order`, `image_name`, `x`, `y`, `w`, `h`, `wwr`, `hwr`)
VALUES ('$id_order', '$image_name', '$x', '$y', '$w', '$h', '$wwr', '$hwr')
");
}

else
{
Db::getInstance()->Execute
("
INSERT INTO `variables` (`id_order`, `image_name`, `x`, `y`, `w`, `h`, `wwr`, `hwr`)
VALUES ('$id_order', 'imagenotexist', '$x', '$y', '$w', '$h', '$wwr', '$hwr')
");
}



 }

 public function hookAdminOrder( $params )
 {
 global $smarty;
 global $base_dir;

   $id_order = $params['id_order'];
   $variabels = Db::getInstance()->ExecuteS("SELECT * FROM `variables` WHERE `id_order` = '$id_order'");


   $smarty->assign(array(
   'x' => $variabels[0]['x'],
   'y' => $variabels[0]['y'],
   'h' => $variabels[0]['h'],
   'w' => $variabels[0]['w'],
   'wwr' => $variabels[0]['wwr'],
   'hwr' => $variabels[0]['hwr'],
   'imagename' => $variabels[0]['image_name']
   ));

   $filename = $variabels[0]['image_name'];

$uploadaddress =  "http://" . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . "upload/php/files/thumbnail/" . $filename;
$smarty->assign('uploadaddress', $uploadaddress);

 return $this->display(__FILE__, 'savevariables.tpl');
}



 }
?>

Link to comment
Share on other sites

I hope someone can give me a little push in the right direction. First time I ever did this and it is not completely clear to me.

 

I have put the code in a php doc with

if (!defined('_PS_VERSION_'))
   exit;

on top.

 

Modules recognizes it, but of course it can only be installed. I am unsure what to do next, because i can not find it anywhere and do not know how or where to implement it.

Link to comment
Share on other sites

it's because module, that you created is only for back offie (for save information in database)

all other stuff related to the front office you have to create manually... the main problem is fact, that we don't know how he created it ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...