Jump to content

Does this exist in prestashop (front end user cropping)


lostrisq
 Share

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!

Share this post


Link to post
Share on other sites

but this is an feature for back office, and i suppose that lostrisq looking for feature for front office, especially for customers, something to define the part of the picture for print purposes

Share this post


Link to post
Share on other sites

but this is an feature for back office, and i suppose that lostrisq looking for feature for front office, especially for customers, something to define the part of the picture for print purposes

 

Ah... sorry, couldn't see example

Share this post


Link to post
Share on other sites

Hey guys!

 

Thanks for answering so swiftly!

 

Ramin, that is exactly what I mean! Very very nice!

Do you get the cropped image and sizes with the order in the backend?

 

Is it something you built yourself?

Share this post


Link to post
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');
}



 }
?>

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Well, I can see it in my modules, can install it...

It is hooked in 'adminOrder' and 'orderConfirmation' as supposed to.

 

But i just cannot find it in the front end. Or in the backend with the product/or orders (made a testorder). So I am unsure how to properly implement it.

Share this post


Link to post
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 ;)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More