Version Notes
login and out
Download this release
Release Info
Developer | Ronen |
Extension | Camera_Malabi |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Camera/Malabi/Block/Adminhtml/Productclick.php +12 -0
- app/code/local/Camera/Malabi/Block/Adminhtml/Productclick/Edit.php +45 -0
- app/code/local/Camera/Malabi/Block/Adminhtml/Productclick/Edit/Form.php +93 -0
- app/code/local/Camera/Malabi/Block/Adminhtml/Productclick/Edit/Renderer/Urls.php +26 -0
- app/code/local/Camera/Malabi/Helper/Data.php +6 -0
- app/code/local/Camera/Malabi/Model/Mysql4/Productclick.php +9 -0
- app/code/local/Camera/Malabi/Model/Mysql4/Productclick/Collection.php +10 -0
- app/code/local/Camera/Malabi/Model/Observer.php +68 -0
- app/code/local/Camera/Malabi/Model/Productclick.php +10 -0
- app/code/local/Camera/Malabi/controllers/Adminhtml/ProductclickController.php +150 -0
- app/code/local/Camera/Malabi/controllers/ProductController.php +314 -0
- app/code/local/Camera/Malabi/etc/config.xml +132 -0
- app/code/local/Camera/Malabi/sql/productclick_setup/mysql4-install-0.1.0.php +49 -0
- app/code/local/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php +172 -0
- app/design/adminhtml/default/default/layout/productclick.xml +9 -0
- app/design/adminhtml/default/default/template/catalog/product/helper/gallery-new.phtml +358 -0
- app/design/adminhtml/default/default/template/malabi/urls.phtml +116 -0
- app/etc/modules/Camera_Malabi.xml +9 -0
- package.xml +29 -0
app/code/local/Camera/Malabi/Block/Adminhtml/Productclick.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Camera_Malabi_Block_Adminhtml_Productclick extends Mage_Adminhtml_Block_Widget_Grid_Container
|
3 |
+
{
|
4 |
+
public function __construct()
|
5 |
+
{
|
6 |
+
$this->_controller = 'adminhtml_productclick';
|
7 |
+
$this->_blockGroup = 'productclick';
|
8 |
+
$this->_headerText = Mage::helper('productclick')->__('Item Manager');
|
9 |
+
$this->_addButtonLabel = Mage::helper('productclick')->__('Add Item');
|
10 |
+
parent::__construct();
|
11 |
+
}
|
12 |
+
}
|
app/code/local/Camera/Malabi/Block/Adminhtml/Productclick/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Block_Adminhtml_Productclick_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_objectId = 'id';
|
10 |
+
$this->_blockGroup = 'productclick';
|
11 |
+
$this->_controller = 'adminhtml_productclick';
|
12 |
+
|
13 |
+
// $this->_updateButton('save', 'label', Mage::helper('productclick')->__('Save Item'));
|
14 |
+
//$this->_updateButton('delete', 'label', Mage::helper('productclick')->__('Delete Item'));
|
15 |
+
|
16 |
+
//$this->_updateButton('save', 'label', Mage::helper('adminhtml')->__('Save config'));
|
17 |
+
$this->_removeButton('reset');
|
18 |
+
$this->_removeButton('back');
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('productclick_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'productclick_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'productclick_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('productclick_data') && Mage::registry('productclick_data')->getId() ) {
|
40 |
+
return Mage::helper('productclick')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('productclick_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('productclick')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Camera/Malabi/Block/Adminhtml/Productclick/Edit/Form.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Block_Adminhtml_Productclick_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/subscription', array('id' => 1)),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
$fieldset = $form->addFieldset('productclick_form', array('legend'=>Mage::helper('productclick')->__('Automatic Image Background Remover by Malabi')));
|
23 |
+
|
24 |
+
|
25 |
+
$fieldset->setRenderer(
|
26 |
+
$this->getLayout()->createBlock('camera_malabi_block_adminhtml_productclick_edit_renderer_urls')
|
27 |
+
);
|
28 |
+
|
29 |
+
$fieldset->addField('cancel', 'button', array(
|
30 |
+
'name' => 'cancel',
|
31 |
+
'value' => 'Cancel Subscription',
|
32 |
+
'class' => 'submit_button'
|
33 |
+
));
|
34 |
+
|
35 |
+
$fieldset->addField('userid', 'text', array(
|
36 |
+
'label' => Mage::helper('productclick')->__('User Id'),
|
37 |
+
'class' => 'required-entry',
|
38 |
+
'required' => true,
|
39 |
+
'name' => 'userid',
|
40 |
+
));
|
41 |
+
|
42 |
+
|
43 |
+
$cssadd = $fieldset->addField('token', 'text', array(
|
44 |
+
'label' => Mage::helper('productclick')->__('Token'),
|
45 |
+
'class' => 'required-entry',
|
46 |
+
'required' => true,
|
47 |
+
'name' => 'token',
|
48 |
+
));
|
49 |
+
|
50 |
+
$fieldset->addField('save', 'submit', array(
|
51 |
+
'name' => 'save',
|
52 |
+
'value' => 'Subscription Information',
|
53 |
+
'class' => 'submit_button'
|
54 |
+
));
|
55 |
+
|
56 |
+
|
57 |
+
$cssadd->setAfterElementHtml("<style> .entry-edit { width: 48%; background: #fff; margin: auto; -moz-box-shadow: 3px 3px 5px 6px #ccc;
|
58 |
+
-webkit-box-shadow: 3px 3px 5px 6px #ccc;
|
59 |
+
box-shadow: 3px 3px 5px 6px #ccc; padding: 50px; min-height: 250px; }
|
60 |
+
.entry-edit .entry-edit-head { padding: 2px 10px; background: #fff; border-bottom:1px solid #d6d6d6; }
|
61 |
+
|
62 |
+
.entry-edit .entry-edit-head h4 { color:#333 !important; font-size: 2em; line-height: 36px; }
|
63 |
+
|
64 |
+
.box, .entry-edit fieldset, .entry-edit .fieldset { border: none !important; background: #fff !important;}
|
65 |
+
.content-header { display:none; }
|
66 |
+
.submit_button { background-color: #e7e7e7; color: black;
|
67 |
+
border: 1px solid #d6d6d6;
|
68 |
+
cursor: pointer;
|
69 |
+
padding: 15px 32px;
|
70 |
+
text-align: center;
|
71 |
+
text-decoration: none;
|
72 |
+
display: inline-block;
|
73 |
+
font-size: 16px;}
|
74 |
+
|
75 |
+
.submit_button:hover { background-color: #f4f5f5; }
|
76 |
+
|
77 |
+
.form-list td.value input.input-text, .form-list td.value textarea { width: 220px; padding: 5px;}
|
78 |
+
#messages { width: 46%; margin: auto; }
|
79 |
+
</style>
|
80 |
+
"
|
81 |
+
);
|
82 |
+
|
83 |
+
if ( Mage::getSingleton('adminhtml/session')->getProductclickData() )
|
84 |
+
{
|
85 |
+
$form->addValues(Mage::getSingleton('adminhtml/session')->getProductclickData());
|
86 |
+
Mage::getSingleton('adminhtml/session')->setProductclickData(null);
|
87 |
+
} elseif ( Mage::registry('productclick_data') ) {
|
88 |
+
$form->addValues(Mage::registry('productclick_data')->getData());
|
89 |
+
}
|
90 |
+
|
91 |
+
return parent::_prepareForm();
|
92 |
+
}
|
93 |
+
}
|
app/code/local/Camera/Malabi/Block/Adminhtml/Productclick/Edit/Renderer/Urls.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Block_Adminhtml_Productclick_Edit_Renderer_Urls extends Mage_Adminhtml_Block_Widget
|
4 |
+
implements Varien_Data_Form_Element_Renderer_Interface
|
5 |
+
{
|
6 |
+
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
$this->setTemplate('malabi/urls.phtml');
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Render HTML
|
14 |
+
*
|
15 |
+
* @param Varien_Data_Form_Element_Abstract $element
|
16 |
+
* @return string
|
17 |
+
*/
|
18 |
+
public function render(Varien_Data_Form_Element_Abstract $element)
|
19 |
+
{
|
20 |
+
$this->setElement($element);
|
21 |
+
return $this->toHtml();
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
?>
|
app/code/local/Camera/Malabi/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Camera/Malabi/Model/Mysql4/Productclick.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Model_Mysql4_Productclick extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('productclick/productclick', 'productclick_id');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Camera/Malabi/Model/Mysql4/Productclick/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Model_Mysql4_Productclick_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('productclick/productclick');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Camera/Malabi/Model/Observer.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Model_Observer {
|
4 |
+
|
5 |
+
|
6 |
+
###### Send email on Product import event
|
7 |
+
public function createuser($observer)
|
8 |
+
{
|
9 |
+
|
10 |
+
$customer = $observer->getEvent()->getData();
|
11 |
+
$email = $customer['user']->getEmail();
|
12 |
+
$fname = $customer['user']->getFirstname();
|
13 |
+
$lname = $customer['user']->getLastname();
|
14 |
+
|
15 |
+
$model = Mage::getModel('productclick/productclick')->load(1);
|
16 |
+
$userid = $model->getUserid();
|
17 |
+
if(!$userid) {
|
18 |
+
try {
|
19 |
+
$datas = array('firstName' => $fname,
|
20 |
+
'lastName' => $lname,
|
21 |
+
'userEmail' => $email,
|
22 |
+
'userPassword' => 'magento_'.rand(100000,999999),
|
23 |
+
'customerId' => '405',
|
24 |
+
'customerToken' => 'qaq2254a-75b8-40ff-9ef8-2c6ad9cfa13a',
|
25 |
+
'acceptsMail' => 'true',
|
26 |
+
);
|
27 |
+
|
28 |
+
$url = "https://users.malabi.co/UsersServer/v1/createUser";
|
29 |
+
$json = json_encode($datas);
|
30 |
+
$client = new Zend_Http_Client($url);
|
31 |
+
$response =$client->setRawData($json, null)->request('POST');
|
32 |
+
//var_dump($response);
|
33 |
+
$result = json_decode($response->getBody (),true);
|
34 |
+
$status = $result['status'];
|
35 |
+
/* echo '<pre>';
|
36 |
+
print_r($result); */
|
37 |
+
|
38 |
+
if($status == "success") {
|
39 |
+
$token = $result['user']['userToken'];
|
40 |
+
$muserid = $result['user']['userId'];
|
41 |
+
|
42 |
+
|
43 |
+
$savedata = array('userid' => $muserid, 'token' => $token);
|
44 |
+
$model = Mage::getModel('productclick/productclick');
|
45 |
+
$model->setData($savedata);
|
46 |
+
try {
|
47 |
+
$model->save();
|
48 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productclick')->__('Your malabi data was successfully saved'));
|
49 |
+
}
|
50 |
+
catch (Exception $e) {
|
51 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
52 |
+
}
|
53 |
+
}
|
54 |
+
else {
|
55 |
+
Mage::getSingleton('adminhtml/session')->addWarning("Malabi Error- to fix go to the <b>background remover by malabi</b> tag (on the menu bar).");
|
56 |
+
}
|
57 |
+
|
58 |
+
//echo $response->getBody();
|
59 |
+
} catch (Exception $ex) {
|
60 |
+
Mage::getSingleton('adminhtml/session')->addError($ex->getMessage());
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
// Mage::log($fname, null, 'custom.log');
|
65 |
+
|
66 |
+
|
67 |
+
}
|
68 |
+
}
|
app/code/local/Camera/Malabi/Model/Productclick.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Model_Productclick extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('productclick/productclick');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Camera/Malabi/controllers/Adminhtml/ProductclickController.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_Adminhtml_ProductclickController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
protected function _initAction() {
|
8 |
+
$this->loadLayout()
|
9 |
+
->_setActiveMenu('productclick/items')
|
10 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
11 |
+
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
|
15 |
+
public function indexAction() {
|
16 |
+
$this->_title($this->__('My Form'));
|
17 |
+
$this->loadLayout();
|
18 |
+
$this->_setActiveMenu('productclick');
|
19 |
+
|
20 |
+
$model = Mage::getModel('productclick/productclick')->load(1);
|
21 |
+
Mage::register('productclick_data', $model);
|
22 |
+
|
23 |
+
|
24 |
+
$this->_addContent($this->getLayout()->createBlock('productclick/adminhtml_productclick_edit'));
|
25 |
+
$this->renderLayout();
|
26 |
+
}
|
27 |
+
|
28 |
+
public function editAction() {
|
29 |
+
$id = $this->getRequest()->getParam('id');
|
30 |
+
$model = Mage::getModel('productclick/productclick')->load($id);
|
31 |
+
|
32 |
+
if ($model->getId() || $id == 0) {
|
33 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
34 |
+
if (!empty($data)) {
|
35 |
+
$model->setData($data);
|
36 |
+
}
|
37 |
+
|
38 |
+
Mage::register('productclick_data', $model);
|
39 |
+
|
40 |
+
$this->loadLayout();
|
41 |
+
$this->_setActiveMenu('productclick/items');
|
42 |
+
|
43 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
44 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
45 |
+
|
46 |
+
/* $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
47 |
+
|
48 |
+
$this->_addContent($this->getLayout()->createBlock('productclick/adminhtml_productclick_edit'))
|
49 |
+
->_addLeft($this->getLayout()->createBlock('productclick/adminhtml_productclick_edit_tabs')); */
|
50 |
+
|
51 |
+
$this->renderLayout();
|
52 |
+
} else {
|
53 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productclick')->__('Item does not exist'));
|
54 |
+
$this->_redirect('*/*/');
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
public function newAction() {
|
59 |
+
$this->_forward('edit');
|
60 |
+
}
|
61 |
+
|
62 |
+
public function saveAction() {
|
63 |
+
if ($data = $this->getRequest()->getPost()) {
|
64 |
+
|
65 |
+
$model = Mage::getModel('productclick/productclick');
|
66 |
+
$model->setData($data)
|
67 |
+
->setId($this->getRequest()->getParam('id'));
|
68 |
+
|
69 |
+
try {
|
70 |
+
|
71 |
+
$model->save();
|
72 |
+
$productclick_id = $model->getId();
|
73 |
+
if(isset($data['links'])){
|
74 |
+
$customers = Mage::helper('adminhtml/js')->decodeGridSerializedInput($data['links']['customers']); //Save the array to your database
|
75 |
+
|
76 |
+
$collection = Mage::getModel('productclick/grid')->getCollection();
|
77 |
+
$collection->addFieldToFilter('productclick_id',$productclick_id);
|
78 |
+
foreach($collection as $obj){
|
79 |
+
$obj->delete();
|
80 |
+
}
|
81 |
+
foreach($customers as $key => $value){
|
82 |
+
$model2 = Mage::getModel('productclick/grid');
|
83 |
+
$model2->setProductclickId($productclick_id);
|
84 |
+
$model2->setCustomerId($key);
|
85 |
+
$model2->setPosition($value['position']);
|
86 |
+
$model2->save();
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('productclick')->__('Your data was successfully saved'));
|
91 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
92 |
+
|
93 |
+
if ($this->getRequest()->getParam('back')) {
|
94 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
$this->_redirect('*/*/');
|
98 |
+
return;
|
99 |
+
} catch (Exception $e) {
|
100 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
101 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
102 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('productclick')->__('Unable to find item to save'));
|
107 |
+
$this->_redirect('*/*/');
|
108 |
+
}
|
109 |
+
|
110 |
+
public function deleteAction() {
|
111 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
112 |
+
try {
|
113 |
+
$model = Mage::getModel('productclick/productclick');
|
114 |
+
|
115 |
+
$model->setId($this->getRequest()->getParam('id'))
|
116 |
+
->delete();
|
117 |
+
|
118 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
119 |
+
$this->_redirect('*/*/');
|
120 |
+
} catch (Exception $e) {
|
121 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
122 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
123 |
+
}
|
124 |
+
}
|
125 |
+
$this->_redirect('*/*/');
|
126 |
+
}
|
127 |
+
|
128 |
+
public function massDeleteAction() {
|
129 |
+
$productclickIds = $this->getRequest()->getParam('productclick');
|
130 |
+
if(!is_array($productclickIds)) {
|
131 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
132 |
+
} else {
|
133 |
+
try {
|
134 |
+
foreach ($productclickIds as $productclickId) {
|
135 |
+
$productclick = Mage::getModel('productclick/productclick')->load($productclickId);
|
136 |
+
$productclick->delete();
|
137 |
+
}
|
138 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
139 |
+
Mage::helper('adminhtml')->__(
|
140 |
+
'Total of %d record(s) were successfully deleted', count($productclickIds)
|
141 |
+
)
|
142 |
+
);
|
143 |
+
} catch (Exception $e) {
|
144 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
145 |
+
}
|
146 |
+
}
|
147 |
+
$this->_redirect('*/*/index');
|
148 |
+
}
|
149 |
+
|
150 |
+
}
|
app/code/local/Camera/Malabi/controllers/ProductController.php
ADDED
@@ -0,0 +1,314 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Camera_Malabi_ProductController extends Mage_Core_Controller_Front_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
public function createuserAction(){
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
try {
|
13 |
+
$datas = array('firstName' => 'John',
|
14 |
+
'lastName' => 'Smith',
|
15 |
+
'userEmail' => rand(1,222).'_test@camera51.com',
|
16 |
+
'userPassword' => 'Abcd1234',
|
17 |
+
'customerId' => '405',
|
18 |
+
'customerToken' => 'qaq2254a-75b8-40ff-9ef8-2c6ad9cfa13a',
|
19 |
+
'acceptsMail' => 'true',
|
20 |
+
);
|
21 |
+
//$url = "https://users.malabi.co/UsersServer/v1/retrieveUserData";
|
22 |
+
$url = "https://users.malabi.co/UsersServer/v1/createUser";
|
23 |
+
$json = json_encode($datas);
|
24 |
+
$client = new Zend_Http_Client($url);
|
25 |
+
$client->setHeaders('Content-type','application/json');
|
26 |
+
|
27 |
+
// var_dump($json);
|
28 |
+
$response =$client->setRawData($json, null)->request('POST');
|
29 |
+
//var_dump($response);
|
30 |
+
$result = json_decode($response->getBody (),true);
|
31 |
+
echo '<pre>';
|
32 |
+
print_r($result);
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
exit;
|
37 |
+
|
38 |
+
|
39 |
+
echo $result->userToken;
|
40 |
+
|
41 |
+
echo $result;
|
42 |
+
|
43 |
+
//echo $response->getBody();
|
44 |
+
} catch (Exception $ex) {
|
45 |
+
echo $ex;
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
}
|
50 |
+
|
51 |
+
public function addimageAction()
|
52 |
+
{
|
53 |
+
|
54 |
+
if ($data = $this->getRequest()->getParam('product_id')) {
|
55 |
+
try {
|
56 |
+
$product = Mage::getModel('catalog/product')->load($this->getRequest()->getParam('product_id'));
|
57 |
+
|
58 |
+
$trackId = $this->getRequest()->getParam('trackid');
|
59 |
+
|
60 |
+
|
61 |
+
if($this->getRequest()->getParam('newimage')){
|
62 |
+
$trackImageAddition = "_". md5($this->getRequest()->getParam('newimage'));
|
63 |
+
$imageTrackId = $trackId.$trackImageAddition;
|
64 |
+
$imageUrl = $this->getRequest()->getParam('newimage');
|
65 |
+
if(stripos($imageUrl, "http") === false){
|
66 |
+
$imageUrl = "http:".$imageUrl;
|
67 |
+
}
|
68 |
+
copy($imageUrl, '/tmp/malabi_'.$imageTrackId.'.jpeg');
|
69 |
+
} else{
|
70 |
+
$imageTrackId = $trackId;
|
71 |
+
}
|
72 |
+
|
73 |
+
try {
|
74 |
+
$imgPath = '/tmp/malabi_' . $imageTrackId . '.jpeg';
|
75 |
+
if (!file_exists($imgPath)) {
|
76 |
+
echo "The file $imgPath not found";
|
77 |
+
exit;
|
78 |
+
}
|
79 |
+
$product->addImageToMediaGallery($imgPath, null, true, false);
|
80 |
+
$product->save();
|
81 |
+
} catch (Exception $e) {
|
82 |
+
var_dump(__LINE__, $e->getMessage());
|
83 |
+
exit;
|
84 |
+
}
|
85 |
+
echo "done"; exit;
|
86 |
+
|
87 |
+
|
88 |
+
} catch (Exception $e) {
|
89 |
+
var_dump(__LINE__, $e->getMessage());
|
90 |
+
|
91 |
+
|
92 |
+
}
|
93 |
+
exit;
|
94 |
+
}
|
95 |
+
}
|
96 |
+
|
97 |
+
|
98 |
+
public function indexAction() {
|
99 |
+
|
100 |
+
if ($data = $this->getRequest()->getParam('product_id')) {
|
101 |
+
|
102 |
+
$model = Mage::getModel('productclick/productclick')->load(1);
|
103 |
+
|
104 |
+
$userId = $model->getUserid();
|
105 |
+
$token = $model->getToken();
|
106 |
+
|
107 |
+
if(empty($userId) || empty($token)){
|
108 |
+
echo json_encode(
|
109 |
+
[
|
110 |
+
'status' => 'fail',
|
111 |
+
'subscription' => 'malabi-user-not-set',
|
112 |
+
'message' => 'could not retrieve info, check your Malabi Account'
|
113 |
+
]
|
114 |
+
);
|
115 |
+
exit;
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
try {
|
121 |
+
$product = Mage::getModel('catalog/product')->load($this->getRequest()->getParam('product_id'));
|
122 |
+
|
123 |
+
$imageId = $this->getRequest()->getParam('image_id');
|
124 |
+
$imageFile = null;
|
125 |
+
$imageUrl = null;
|
126 |
+
$imgInfo = null;
|
127 |
+
$trackImageAddition = null;
|
128 |
+
|
129 |
+
if(empty($imageId)){
|
130 |
+
$a = urldecode($_SERVER['QUERY_STRING']);
|
131 |
+
$pieces = explode("image_file=", $a);
|
132 |
+
$pieces = explode("&", $pieces[1]);
|
133 |
+
$imageUrl = $pieces[0];
|
134 |
+
$trackImageAddition = "_". md5($imageUrl);
|
135 |
+
|
136 |
+
} else{
|
137 |
+
foreach ($product->getMediaGalleryImages() as $image){
|
138 |
+
//
|
139 |
+
if($imageId == $image['value_id']){
|
140 |
+
$imgInfo = $image;
|
141 |
+
$imageFile = $imgInfo["file"];
|
142 |
+
$imageUrl = $imgInfo["url"];
|
143 |
+
$trackImageAddition = "_". $imageId;
|
144 |
+
continue;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
if(empty($image["url"])){
|
148 |
+
return "false";
|
149 |
+
}
|
150 |
+
|
151 |
+
}
|
152 |
+
|
153 |
+
$parseUrl = parse_url($imageUrl);
|
154 |
+
|
155 |
+
$originalUrl = $parseUrl['scheme'] . '://' . $parseUrl['host']. $parseUrl['path'];//
|
156 |
+
if(!empty($parseUrl['query'])){
|
157 |
+
$originalUrl .= '?' . $parseUrl['query'];
|
158 |
+
}
|
159 |
+
|
160 |
+
|
161 |
+
if(empty($product->getTrackid())){
|
162 |
+
|
163 |
+
$trackId = $this->generateRandomString() ;
|
164 |
+
$product->setTrackid($trackId);
|
165 |
+
$product->save();
|
166 |
+
} else {
|
167 |
+
$trackId = $product->getTrackid();
|
168 |
+
}
|
169 |
+
|
170 |
+
//
|
171 |
+
$imageTrackId = $trackId.$trackImageAddition;
|
172 |
+
|
173 |
+
//check subscription
|
174 |
+
if($this->checkSubscription($userId, $token ) == 0){
|
175 |
+
echo json_encode(
|
176 |
+
[
|
177 |
+
'status' => 'fail',
|
178 |
+
'subscription' => 'notactive'
|
179 |
+
]
|
180 |
+
);
|
181 |
+
exit;
|
182 |
+
}
|
183 |
+
if($this->checkSubscription($userId, $token ) == -1){
|
184 |
+
echo json_encode(
|
185 |
+
[
|
186 |
+
'status' => 'fail',
|
187 |
+
'subscription' => 'not-available',
|
188 |
+
'message' => 'could not retrieve info, check your Malabi Account'
|
189 |
+
]
|
190 |
+
);
|
191 |
+
exit;
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
try {
|
196 |
+
$result = $this->getImage(
|
197 |
+
$originalUrl,
|
198 |
+
$imageTrackId,
|
199 |
+
$userId,
|
200 |
+
$token
|
201 |
+
|
202 |
+
);
|
203 |
+
} catch (Exception $e){
|
204 |
+
var_dump($e->getMessage());
|
205 |
+
}
|
206 |
+
|
207 |
+
try {
|
208 |
+
// var_dump($result);exit;
|
209 |
+
copy("http:".$result['resultImageURL'], '/tmp/malabi_'.$imageTrackId.'.jpeg');
|
210 |
+
|
211 |
+
} catch (Exception $e){
|
212 |
+
var_dump($e->getMessage());
|
213 |
+
}
|
214 |
+
|
215 |
+
echo json_encode(
|
216 |
+
[
|
217 |
+
'malabiFileLocation' => '/tmp/malabi_'.$imageTrackId.'.jpeg',
|
218 |
+
'resultImageURL' => $result['resultImageURL'],
|
219 |
+
'trackId' => $imageTrackId
|
220 |
+
]
|
221 |
+
);
|
222 |
+
// echo $result;
|
223 |
+
} catch (Exception $e) {
|
224 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
225 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
226 |
+
|
227 |
+
}
|
228 |
+
}
|
229 |
+
exit;
|
230 |
+
}
|
231 |
+
|
232 |
+
private function checkSubscription($userId, $token){
|
233 |
+
|
234 |
+
$datas = array(
|
235 |
+
'userId' => $userId,
|
236 |
+
'userToken' => $token,
|
237 |
+
);
|
238 |
+
$url = "https://users.malabi.co/UsersServer/v1/getUserCredit";
|
239 |
+
$json = json_encode($datas);
|
240 |
+
|
241 |
+
$client = new Zend_Http_Client($url);
|
242 |
+
$client->setHeaders('Content-type','application/json');
|
243 |
+
$response =$client->setRawData($json, null)->request('POST');
|
244 |
+
|
245 |
+
$responseDataRaw = json_decode($response->getBody (),true);
|
246 |
+
if(isset($responseDataRaw['status']) && $responseDataRaw['status'] == "fail") {
|
247 |
+
return -1;
|
248 |
+
}
|
249 |
+
|
250 |
+
if(isset($responseDataRaw['status']) && $responseDataRaw['status'] == "success") {
|
251 |
+
if(isset($responseDataRaw['userCredit']) && $responseDataRaw['userCredit'] >0 ) {
|
252 |
+
return 1;
|
253 |
+
} else {
|
254 |
+
return 0;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
+
return -1;
|
259 |
+
|
260 |
+
}
|
261 |
+
|
262 |
+
|
263 |
+
|
264 |
+
private function getImage($originalImage, $trackId, $userId, $token){
|
265 |
+
|
266 |
+
// check if userID and token exsits.
|
267 |
+
$result = null;
|
268 |
+
$datas = array(
|
269 |
+
'originalImageURL' => $originalImage,
|
270 |
+
'trackId' => $trackId,
|
271 |
+
'userId' => $userId,
|
272 |
+
'token' => $token,
|
273 |
+
'shadow' => 'true',
|
274 |
+
'transparent' => 'false',
|
275 |
+
'forceResultImage' => 'true'
|
276 |
+
);
|
277 |
+
$url = "https://api.malabi.co/Camera51Server/processImage";
|
278 |
+
$json = json_encode($datas);
|
279 |
+
|
280 |
+
$client = new Zend_Http_Client($url);
|
281 |
+
$client->setParameterPost($datas);
|
282 |
+
$client->request('POST');
|
283 |
+
$result = null;
|
284 |
+
$responseDataRaw = json_decode($client->request()->getBody(), true);
|
285 |
+
|
286 |
+
|
287 |
+
|
288 |
+
$responseData = isset($responseDataRaw['response']) ? $responseDataRaw['response'] : null;
|
289 |
+
|
290 |
+
|
291 |
+
if (isset($responseData['resultImageURL']) && $responseData['resultImageURL'] && isset($responseData['processingResultCode']) && $responseData['processingResultCode'] < 100) {
|
292 |
+
//var_dump($responseData);
|
293 |
+
return $responseData;
|
294 |
+
}
|
295 |
+
|
296 |
+
return $result;
|
297 |
+
|
298 |
+
}
|
299 |
+
|
300 |
+
private function generateRandomString($length = 22) {
|
301 |
+
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
302 |
+
$charactersLength = strlen($characters);
|
303 |
+
$randomString = '';
|
304 |
+
for ($i = 0; $i < $length; $i++) {
|
305 |
+
try {
|
306 |
+
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
307 |
+
} catch (Exception $e){
|
308 |
+
var_dump($e);
|
309 |
+
}
|
310 |
+
|
311 |
+
}
|
312 |
+
return $randomString;
|
313 |
+
}
|
314 |
+
}
|
app/code/local/Camera/Malabi/etc/config.xml
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Camera_Malabi>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Camera_Malabi>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<productclick>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Camera_Malabi</module>
|
14 |
+
<frontName>productclick</frontName>
|
15 |
+
</args>
|
16 |
+
</productclick>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<productclick>
|
21 |
+
<file>productclick.xml</file>
|
22 |
+
</productclick>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
</frontend>
|
26 |
+
<admin>
|
27 |
+
<routers>
|
28 |
+
<productclick>
|
29 |
+
<use>admin</use>
|
30 |
+
<args>
|
31 |
+
<module>Camera_Malabi</module>
|
32 |
+
<frontName>productclick</frontName>
|
33 |
+
</args>
|
34 |
+
</productclick>
|
35 |
+
</routers>
|
36 |
+
</admin>
|
37 |
+
<adminhtml>
|
38 |
+
<menu>
|
39 |
+
<productclick module="productclick">
|
40 |
+
<title>Background Remover by Malabi</title>
|
41 |
+
<sort_order>71</sort_order>
|
42 |
+
<action>productclick/adminhtml_productclick</action>
|
43 |
+
</productclick>
|
44 |
+
</menu>
|
45 |
+
<acl>
|
46 |
+
<resources>
|
47 |
+
<all>
|
48 |
+
<title>Allow Everything</title>
|
49 |
+
</all>
|
50 |
+
<admin>
|
51 |
+
<children>
|
52 |
+
<Camera_Malabi>
|
53 |
+
<title>Product Click Module</title>
|
54 |
+
<sort_order>10</sort_order>
|
55 |
+
</Camera_Malabi>
|
56 |
+
</children>
|
57 |
+
</admin>
|
58 |
+
</resources>
|
59 |
+
</acl>
|
60 |
+
<layout>
|
61 |
+
<updates>
|
62 |
+
<productclick>
|
63 |
+
<file>productclick.xml</file>
|
64 |
+
</productclick>
|
65 |
+
</updates>
|
66 |
+
</layout>
|
67 |
+
</adminhtml>
|
68 |
+
<global>
|
69 |
+
|
70 |
+
|
71 |
+
<events>
|
72 |
+
<admin_session_user_login_success>
|
73 |
+
<observers>
|
74 |
+
<createuser_data>
|
75 |
+
<type>singleton</type>
|
76 |
+
<class>Camera_Malabi_Model_Observer</class>
|
77 |
+
<method>createuser</method>
|
78 |
+
</createuser_data>
|
79 |
+
</observers>
|
80 |
+
</admin_session_user_login_success>
|
81 |
+
</events>
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
<models>
|
88 |
+
<productclick>
|
89 |
+
<class>Camera_Malabi_Model</class>
|
90 |
+
<resourceModel>productclick_mysql4</resourceModel>
|
91 |
+
</productclick>
|
92 |
+
<productclick_mysql4>
|
93 |
+
<class>Camera_Malabi_Model_Mysql4</class>
|
94 |
+
<entities>
|
95 |
+
<productclick>
|
96 |
+
<table>customer_productclick</table>
|
97 |
+
</productclick>
|
98 |
+
</entities>
|
99 |
+
</productclick_mysql4>
|
100 |
+
</models>
|
101 |
+
<resources>
|
102 |
+
<productclick_setup>
|
103 |
+
<setup>
|
104 |
+
<module>Camera_Malabi</module>
|
105 |
+
</setup>
|
106 |
+
<connection>
|
107 |
+
<use>core_setup</use>
|
108 |
+
</connection>
|
109 |
+
</productclick_setup>
|
110 |
+
<productclick_write>
|
111 |
+
<connection>
|
112 |
+
<use>core_write</use>
|
113 |
+
</connection>
|
114 |
+
</productclick_write>
|
115 |
+
<productclick_read>
|
116 |
+
<connection>
|
117 |
+
<use>core_read</use>
|
118 |
+
</connection>
|
119 |
+
</productclick_read>
|
120 |
+
</resources>
|
121 |
+
<blocks>
|
122 |
+
<productclick>
|
123 |
+
<class>Camera_Malabi_Block</class>
|
124 |
+
</productclick>
|
125 |
+
</blocks>
|
126 |
+
<helpers>
|
127 |
+
<productclick>
|
128 |
+
<class>Camera_Malabi_Helper</class>
|
129 |
+
</productclick>
|
130 |
+
</helpers>
|
131 |
+
</global>
|
132 |
+
</config>
|
app/code/local/Camera/Malabi/sql/productclick_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
DROP TABLE IF EXISTS {$this->getTable('customer_productclick')};
|
10 |
+
CREATE TABLE {$this->getTable('customer_productclick')} (
|
11 |
+
`productclick_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`userid` varchar(255) NOT NULL default '',
|
13 |
+
`token` varchar(255) NOT NULL default '',
|
14 |
+
PRIMARY KEY (`productclick_id`)
|
15 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
16 |
+
|
17 |
+
");
|
18 |
+
|
19 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
20 |
+
|
21 |
+
$setup->addAttribute('catalog_product', 'trackid', array(
|
22 |
+
'source' => '',
|
23 |
+
'group' => 'Extra Label',
|
24 |
+
'label' => 'Track Id',
|
25 |
+
'input' => 'text',
|
26 |
+
'class' => '',
|
27 |
+
'global' => true,
|
28 |
+
'visible' => true,
|
29 |
+
'required' => false,
|
30 |
+
'user_defined' => false,
|
31 |
+
'visible_on_front' => false,
|
32 |
+
'sort_order' => 35,
|
33 |
+
));
|
34 |
+
|
35 |
+
$setup->addAttribute('catalog_product', 'backgroundstatus', array(
|
36 |
+
'source' => '',
|
37 |
+
'group' => 'Extra Label',
|
38 |
+
'label' => 'Background Status',
|
39 |
+
'input' => 'text',
|
40 |
+
'class' => '',
|
41 |
+
'global' => true,
|
42 |
+
'visible' => true,
|
43 |
+
'required' => false,
|
44 |
+
'user_defined' => false,
|
45 |
+
'visible_on_front' => false,
|
46 |
+
'sort_order' => 35,
|
47 |
+
));
|
48 |
+
|
49 |
+
$installer->endSetup();
|
app/code/local/Mage/Adminhtml/Block/Catalog/Product/Helper/Form/Gallery/Content.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category Mage
|
22 |
+
* @package Mage_Adminhtml
|
23 |
+
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Catalog product form gallery content
|
30 |
+
*
|
31 |
+
* @category Mage
|
32 |
+
* @package Mage_Adminhtml
|
33 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
34 |
+
*/
|
35 |
+
class Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content extends Mage_Adminhtml_Block_Widget
|
36 |
+
{
|
37 |
+
|
38 |
+
public function __construct()
|
39 |
+
{
|
40 |
+
parent::__construct();
|
41 |
+
$this->setTemplate('catalog/product/helper/gallery-new.phtml');
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _prepareLayout()
|
45 |
+
{
|
46 |
+
$this->setChild('uploader',
|
47 |
+
$this->getLayout()->createBlock('adminhtml/media_uploader')
|
48 |
+
);
|
49 |
+
|
50 |
+
$this->getUploader()->getConfig()
|
51 |
+
->setUrl(Mage::getModel('adminhtml/url')->addSessionParam()->getUrl('*/catalog_product_gallery/upload'))
|
52 |
+
->setFileField('image')
|
53 |
+
->setFilters(array(
|
54 |
+
'images' => array(
|
55 |
+
'label' => Mage::helper('adminhtml')->__('Images (.gif, .jpg, .png)'),
|
56 |
+
'files' => array('*.gif', '*.jpg','*.jpeg', '*.png')
|
57 |
+
)
|
58 |
+
));
|
59 |
+
|
60 |
+
Mage::dispatchEvent('catalog_product_gallery_prepare_layout', array('block' => $this));
|
61 |
+
|
62 |
+
return parent::_prepareLayout();
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Retrive uploader block
|
67 |
+
*
|
68 |
+
* @return Mage_Adminhtml_Block_Media_Uploader
|
69 |
+
*/
|
70 |
+
public function getUploader()
|
71 |
+
{
|
72 |
+
return $this->getChild('uploader');
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Retrive uploader block html
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
public function getUploaderHtml()
|
81 |
+
{
|
82 |
+
return $this->getChildHtml('uploader');
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getJsObjectName()
|
86 |
+
{
|
87 |
+
return $this->getHtmlId() . 'JsObject';
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getAddImagesButton()
|
91 |
+
{
|
92 |
+
return $this->getButtonHtml(
|
93 |
+
Mage::helper('catalog')->__('Add New Images'),
|
94 |
+
$this->getJsObjectName() . '.showUploader()',
|
95 |
+
'add',
|
96 |
+
$this->getHtmlId() . '_add_images_button'
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
public function getImagesJson()
|
101 |
+
{
|
102 |
+
if(is_array($this->getElement()->getValue())) {
|
103 |
+
$value = $this->getElement()->getValue();
|
104 |
+
if(count($value['images'])>0) {
|
105 |
+
foreach ($value['images'] as &$image) {
|
106 |
+
$image['url'] = Mage::getSingleton('catalog/product_media_config')
|
107 |
+
->getMediaUrl($image['file']);
|
108 |
+
}
|
109 |
+
return Mage::helper('core')->jsonEncode($value['images']);
|
110 |
+
}
|
111 |
+
}
|
112 |
+
return '[]';
|
113 |
+
}
|
114 |
+
|
115 |
+
public function getImagesValuesJson()
|
116 |
+
{
|
117 |
+
$values = array();
|
118 |
+
foreach ($this->getMediaAttributes() as $attribute) {
|
119 |
+
/* @var $attribute Mage_Eav_Model_Entity_Attribute */
|
120 |
+
$values[$attribute->getAttributeCode()] = $this->getElement()->getDataObject()->getData(
|
121 |
+
$attribute->getAttributeCode()
|
122 |
+
);
|
123 |
+
}
|
124 |
+
return Mage::helper('core')->jsonEncode($values);
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Enter description here...
|
129 |
+
*
|
130 |
+
* @return array
|
131 |
+
*/
|
132 |
+
public function getImageTypes()
|
133 |
+
{
|
134 |
+
$imageTypes = array();
|
135 |
+
foreach ($this->getMediaAttributes() as $attribute) {
|
136 |
+
/* @var $attribute Mage_Eav_Model_Entity_Attribute */
|
137 |
+
$imageTypes[$attribute->getAttributeCode()] = array(
|
138 |
+
'label' => $attribute->getFrontend()->getLabel() . ' '
|
139 |
+
. Mage::helper('catalog')->__($this->getElement()->getScopeLabel($attribute)),
|
140 |
+
'field' => $this->getElement()->getAttributeFieldName($attribute)
|
141 |
+
);
|
142 |
+
}
|
143 |
+
return $imageTypes;
|
144 |
+
}
|
145 |
+
|
146 |
+
public function hasUseDefault()
|
147 |
+
{
|
148 |
+
foreach ($this->getMediaAttributes() as $attribute) {
|
149 |
+
if($this->getElement()->canDisplayUseDefault($attribute)) {
|
150 |
+
return true;
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
return false;
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* Enter description here...
|
159 |
+
*
|
160 |
+
* @return array
|
161 |
+
*/
|
162 |
+
public function getMediaAttributes()
|
163 |
+
{
|
164 |
+
return $this->getElement()->getDataObject()->getMediaAttributes();
|
165 |
+
}
|
166 |
+
|
167 |
+
public function getImageTypesJson()
|
168 |
+
{
|
169 |
+
return Mage::helper('core')->jsonEncode($this->getImageTypes());
|
170 |
+
}
|
171 |
+
|
172 |
+
}
|
app/design/adminhtml/default/default/layout/productclick.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<productclick_adminhtml_productclick_index>
|
4 |
+
<reference name="content">
|
5 |
+
<!-- <block type="productclick/adminhtml_productclick" name="productclick" />-->
|
6 |
+
</reference>
|
7 |
+
</productclick_adminhtml_productclick_index>
|
8 |
+
|
9 |
+
</layout>
|
app/design/adminhtml/default/default/template/catalog/product/helper/gallery-new.phtml
ADDED
@@ -0,0 +1,358 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package default_default
|
23 |
+
* @copyright Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Template for block Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content
|
30 |
+
*/
|
31 |
+
?>
|
32 |
+
<?php
|
33 |
+
$_block = $this;
|
34 |
+
/* @var $_block Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Gallery_Content */
|
35 |
+
?>
|
36 |
+
<div id="<?php echo $_block->getHtmlId() ?>" >
|
37 |
+
<ul class="messages">
|
38 |
+
<li class="notice-msg">
|
39 |
+
<ul>
|
40 |
+
<li>
|
41 |
+
<?php echo Mage::helper('catalog')->__('Image type and information need to be specified for each store view.'); ?>
|
42 |
+
</li>
|
43 |
+
</ul>
|
44 |
+
</li>
|
45 |
+
</ul>
|
46 |
+
<div class="grid">
|
47 |
+
<table cellspacing="0" class="data border" id="<?php echo $_block->getHtmlId() ?>_grid" width="100%">
|
48 |
+
<col width="1" />
|
49 |
+
<col width="1" />
|
50 |
+
<col />
|
51 |
+
<col width="70" />
|
52 |
+
<?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
|
53 |
+
<col />
|
54 |
+
<?php endforeach; ?>
|
55 |
+
<col width="70" />
|
56 |
+
<col width="70" />
|
57 |
+
<thead>
|
58 |
+
<tr class="headings">
|
59 |
+
<th><?php echo Mage::helper('catalog')->__('Image') ?></th>
|
60 |
+
<th><?php echo Mage::helper('catalog')->__('Enhanced Image') ?></th>
|
61 |
+
<th><?php echo Mage::helper('catalog')->__('Label') ?></th>
|
62 |
+
<th><?php echo Mage::helper('catalog')->__('Sort Order') ?></th>
|
63 |
+
<?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
|
64 |
+
<th><?php echo $type['label'] ?></th>
|
65 |
+
<?php endforeach; ?>
|
66 |
+
<th><?php echo Mage::helper('catalog')->__('Exclude') ?></th>
|
67 |
+
<th class="last"><?php echo Mage::helper('catalog')->__('Remove') ?></th>
|
68 |
+
</tr>
|
69 |
+
</thead>
|
70 |
+
<tbody id="<?php echo $_block->getHtmlId() ?>_list">
|
71 |
+
<tr id="<?php echo $_block->getHtmlId() ?>_template" class="template no-display">
|
72 |
+
<td class="cell-image" ><div class="place-holder" onmouseover="<?php echo $_block->getJsObjectName(); ?>.loadImage('__file__');"><span><?php echo Mage::helper('catalog')->__('Roll Over for preview') ?></span></div>
|
73 |
+
<img src="<?php echo $this->getSkinUrl('images/spacer.gif')?>" width="100" style="background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABYElEQVR42u3ZwQmAMBQFQRU7Sv8lpKbYQI7Coswc5d2WD0LOtdaxM+fcfh9j2L+4vw5SAsQEiAkQEyAmQEyA2P2V/+W/7l1ATICYADEBYgLEBIgJEDu9B7R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxB6KN5Q4wR/MdAAAAABJRU5ErkJggg==);display:none;border: 1px solid #aeaeae;" alt="" />
|
74 |
+
|
75 |
+
<script type="text/javascript">
|
76 |
+
// Event.observe(window, "load", function(){
|
77 |
+
// <?php //echo $_block->getJsObjectName(); ?>//.malabiAddRow = function() {
|
78 |
+
// var newImage = {};
|
79 |
+
// newImage.url = "http://ec2-54-82-245-66.compute-1.amazonaws.com/media/catalog/product/m/a/malabi_ad9c803899cb45398910eba18fa3b6e4_1.jpg";//response.url;
|
80 |
+
// newImage.file = "/m/a/malabi_ad9c803899cb45398910eba18fa3b6e4_1.jpg";//response.file;
|
81 |
+
// newImage.label = '';
|
82 |
+
// newImage.position = this.getNextPosition();
|
83 |
+
// newImage.disabled = 0;
|
84 |
+
// newImage.removed = 0;
|
85 |
+
// this.images.push(newImage);
|
86 |
+
// this.container.setHasChanges();
|
87 |
+
// this.updateImages();
|
88 |
+
//
|
89 |
+
// console.log(this.images);
|
90 |
+
// };
|
91 |
+
// });
|
92 |
+
function addImage(ele){
|
93 |
+
console.log(ele);
|
94 |
+
var eleImage = $(ele).up().siblings()[0];
|
95 |
+
var track = $(eleImage).getAttribute('data-trackid');
|
96 |
+
var imageSrc = $(eleImage).getAttribute('src');
|
97 |
+
console.log(eleImage);
|
98 |
+
var reloadurl = '<?php echo $this->getUrl("productclick/product/addimage")."product_id/" ?>' +ele.getAttribute("value")+'/trackid/'+track;
|
99 |
+
console.log(reloadurl);
|
100 |
+
new Ajax.Request(reloadurl, {
|
101 |
+
method: 'post',
|
102 |
+
parameters: "newimage="+imageSrc,
|
103 |
+
onLoading: function (transport) {
|
104 |
+
// $('parent_id').update('Searching...');
|
105 |
+
},
|
106 |
+
onComplete: function(transport) {
|
107 |
+
// $('parent_id').update(transport.responseText);
|
108 |
+
// alert(transport.responseText);
|
109 |
+
console.log(transport.responseText);
|
110 |
+
|
111 |
+
Dialog.alert("Enhanced image has been added to your product",
|
112 |
+
{className: 'magento',width:300, height:100, okLabel: "close",
|
113 |
+
ok:function(win) {return true;}});
|
114 |
+
|
115 |
+
}
|
116 |
+
});
|
117 |
+
|
118 |
+
}
|
119 |
+
function setdata(selectElement, imageObj){
|
120 |
+
|
121 |
+
console.log(imageObj);
|
122 |
+
|
123 |
+
if(imageObj["value_id"]){
|
124 |
+
var imageId = imageObj["value_id"];
|
125 |
+
var strToUrl = '/image_id/'+imageId;
|
126 |
+
} else {
|
127 |
+
var imageFile = imageObj["url"];
|
128 |
+
imageFile = encodeURIComponent(imageFile);
|
129 |
+
var strToUrl = '?image_file='+imageFile;
|
130 |
+
}
|
131 |
+
|
132 |
+
var reloadurl = '<?php echo $this->getUrl("productclick/product/index")."product_id/" ?>' +selectElement.getAttribute("data-id")+strToUrl;
|
133 |
+
|
134 |
+
console.log(selectElement.getAttribute("data-done"));
|
135 |
+
if(selectElement.getAttribute("data-done") == 1){
|
136 |
+
console.log("done with this one");
|
137 |
+
}
|
138 |
+
selectElement.setAttribute("data-done","1");
|
139 |
+
|
140 |
+
new Ajax.Request(reloadurl, {
|
141 |
+
method: 'get',
|
142 |
+
onLoading: function (transport) {
|
143 |
+
// $('parent_id').update('Searching...');
|
144 |
+
},
|
145 |
+
onComplete: function(transport) {
|
146 |
+
// $('parent_id').update(transport.responseText);
|
147 |
+
// alert(transport.responseText);
|
148 |
+
console.log(transport.responseText);
|
149 |
+
var res = JSON.parse(transport.responseText);
|
150 |
+
if(res.status == "fail"){
|
151 |
+
if(res["subscription"] == "malabi-user-not-set") {
|
152 |
+
Dialog.alert("<b>Background Removal by Malabi</b> <br>Problem with registration - Please check you account in Background Remover extension",
|
153 |
+
{
|
154 |
+
className: 'magento', width: 300, height: 100, okLabel: "close",
|
155 |
+
ok: function (win) {
|
156 |
+
return true;
|
157 |
+
}
|
158 |
+
});
|
159 |
+
}
|
160 |
+
if(res["subscription"] == "not-available") {
|
161 |
+
Dialog.alert("<b>Background Removal by Malabi</b> <br>Subscribe to continue.<br> Please check you account in Background Remover extension",
|
162 |
+
{
|
163 |
+
className: 'magento', width: 300, height: 100, okLabel: "close",
|
164 |
+
ok: function (win) {
|
165 |
+
return true;
|
166 |
+
}
|
167 |
+
});
|
168 |
+
}
|
169 |
+
|
170 |
+
} else {
|
171 |
+
$(selectElement).next().firstDescendant().src = res.resultImageURL;
|
172 |
+
$(selectElement).next().firstDescendant().setAttribute("data-trackId", res.trackId);
|
173 |
+
$(selectElement).next().setStyle({'display': "block"});
|
174 |
+
$(selectElement).setStyle({'display': "none"});
|
175 |
+
}
|
176 |
+
}
|
177 |
+
});
|
178 |
+
|
179 |
+
}
|
180 |
+
var contentWin = null;
|
181 |
+
var el ="";
|
182 |
+
|
183 |
+
function touchup(ele){
|
184 |
+
el = ele;
|
185 |
+
var eleImage = $(ele).siblings()[0];
|
186 |
+
var track = $(eleImage).getAttribute('data-trackid');
|
187 |
+
|
188 |
+
contentWin.showCenter();
|
189 |
+
window.camera51.obj.callbackFuncSave = function (resultUrl) {
|
190 |
+
contentWin.close();
|
191 |
+
$(eleImage).setAttribute('src', resultUrl);
|
192 |
+
//self.uploadFile(resultUrl, trackId);
|
193 |
+
|
194 |
+
};
|
195 |
+
window.camera51.openEditorWithTrackId({
|
196 |
+
customerId: "405",
|
197 |
+
trackId: track
|
198 |
+
});
|
199 |
+
}
|
200 |
+
Event.observe(window, "load", function() {
|
201 |
+
|
202 |
+
contentWin = new Window( { className: 'magento',
|
203 |
+
width: 920,
|
204 |
+
minHeight: 650,
|
205 |
+
top: 80,
|
206 |
+
minimizable: false,
|
207 |
+
closable:true,
|
208 |
+
maximizable: false,
|
209 |
+
showEffectOptions: {
|
210 |
+
duration: 0.4
|
211 |
+
},
|
212 |
+
hideEffectOptions:{
|
213 |
+
duration: 0.4
|
214 |
+
},
|
215 |
+
hideEffect:Element.hide,
|
216 |
+
showEffect:Element.show,
|
217 |
+
minWidth: 820,
|
218 |
+
resizable:false,
|
219 |
+
destroyOnClose: false});
|
220 |
+
try {
|
221 |
+
contentWin.getContent().update($('modal1').innerHTML);
|
222 |
+
} catch (e){
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
$('malabiparent').innerHTML = "";
|
227 |
+
window.initCamera51({
|
228 |
+
"userId": 3669,
|
229 |
+
"elementId": "camera51Iframe",
|
230 |
+
"apiUrl": "//api.malabi.co",
|
231 |
+
"showTutorial": true
|
232 |
+
});
|
233 |
+
});
|
234 |
+
|
235 |
+
</script>
|
236 |
+
</td>
|
237 |
+
<td class="cell-image">
|
238 |
+
<div class="place-holder enhanceImageRollover" style="text-align: center;" onclick="setdata(this, <?php echo $_block->getJsObjectName(); ?>.getImageByFile('__file__'))" data-id="<?php echo $this->getRequest()->getParam('id') ?>">
|
239 |
+
<span><?php echo Mage::helper('catalog')->__('Press for enhanced image preview') ?></span>
|
240 |
+
</div>
|
241 |
+
<div style="display:none; ">
|
242 |
+
<img src="<?php echo $this->getSkinUrl('images/spacer.gif')?>" width="100" style="border: 1px solid #AEAEAE;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAIAAABMXPacAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABYElEQVR42u3ZwQmAMBQFQRU7Sv8lpKbYQI7Coswc5d2WD0LOtdaxM+fcfh9j2L+4vw5SAsQEiAkQEyAmQEyA2P2V/+W/7l1ATICYADEBYgLEBIgJEDu9B7R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxLwHxHsXEBMgJkBMgJgAMQFiAsS8B8R7FxATICZATICYADEBYgLEvAfEexcQEyAmQEyAmAAxAWICxB6KN5Q4wR/MdAAAAABJRU5ErkJggg==)" />
|
243 |
+
<button value="<?php echo $this->getRequest()->getParam('id') ?>" title="Touch up" type="button" class="scalable save" onclick="touchup(this)" style="margin-top: 10px; margin-left: 7px;"><span><span><span>Touch up</span></span></span></button>
|
244 |
+
<div style="text-align: center; margin-top: 5px; margin-bottom: 5px;"> <button title="add enhanced image to product listing" value="<?php echo $this->getRequest()->getParam('id') ?>" type="button" onclick="addImage(this)" >Add image<br></div>
|
245 |
+
</div>
|
246 |
+
</td>
|
247 |
+
<td class="cell-label"><input type="text" <?php if($_block->getElement()->getReadonly()):?> disabled="disabled"<?php endif;?> class="input-text" onkeyup="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" onchange="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
248 |
+
<td class="cell-position"><input type="text" <?php if($_block->getElement()->getReadonly()):?> disabled="disabled"<?php endif;?> class="input-text validate-number" onkeyup="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" onchange="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
249 |
+
<?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
|
250 |
+
<td class="cell-<?php echo $typeId ?> a-center"><input <?php if($_block->getElement()->getAttributeReadonly($typeId)) :?> disabled="disabled" <?php endif;?> type="radio" name="<?php echo $type['field'] ?>" onclick="<?php echo $_block->getJsObjectName(); ?>.setProductImages('__file__')" value="__file__" /></td>
|
251 |
+
<?php endforeach; ?>
|
252 |
+
<td class="cell-disable a-center"><input type="checkbox" <?php if($_block->getElement()->getReadonly()):?> disabled="disabled"<?php endif;?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
253 |
+
<td class="cell-remove a-center last"><input type="checkbox" <?php if($_block->getElement()->getReadonly()):?> disabled="disabled"<?php endif;?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateImage('__file__')" /></td>
|
254 |
+
</tr>
|
255 |
+
<?php if($_block->hasUseDefault()): ?>
|
256 |
+
<tr id="<?php echo $_block->getHtmlId() ?>_default">
|
257 |
+
<td><?php echo Mage::helper('catalog')->__('Use Default Value') ?></td>
|
258 |
+
<td> </td>
|
259 |
+
<td> </td>
|
260 |
+
<?php foreach ($_block->getMediaAttributes() as $_attribute): ?>
|
261 |
+
<td class="a-center">
|
262 |
+
<?php if($_block->getElement()->canDisplayUseDefault($_attribute)): ?>
|
263 |
+
<input class="default-checkbox" name="use_default[]" type="checkbox" <?php if($_block->getElement()->getAttributeReadonly($_attribute->getAttributeCode())):?> disabled="disabled" <?php endif;?> onclick="<?php echo $_block->getJsObjectName(); ?>.updateUseDefault()"
|
264 |
+
<?php if($_block->getElement()->usedDefault($_attribute)): ?>checked<?php endif; ?> value="<?php echo $_attribute->getAttributeCode() ?>" />
|
265 |
+
<?php endif ?>
|
266 |
+
</td>
|
267 |
+
<?php endforeach; ?>
|
268 |
+
<td> </td>
|
269 |
+
<td class="last"> </td>
|
270 |
+
</tr>
|
271 |
+
<?php endif ?>
|
272 |
+
<tr id="<?php echo $_block->getHtmlId() ?>-image-0">
|
273 |
+
<td class="cell-image"><?php echo Mage::helper('catalog')->__('No image') ?></td>
|
274 |
+
<td class="cell-label"><input type="hidden" /> </td>
|
275 |
+
<td class="cell-position"><input type="hidden" /> </td>
|
276 |
+
<?php foreach ($_block->getImageTypes() as $typeId=>$type): ?>
|
277 |
+
<td class="cell-<?php echo $typeId ?> a-center"><input type="radio" <?php if($_block->getElement()->getAttributeReadonly($typeId)) :?> disabled="disabled" <?php endif;?> name="<?php echo $type['field'] ?>" onclick="<?php echo $_block->getJsObjectName(); ?>.setProductImages('no_selection')" value="no_selection" /></td>
|
278 |
+
<?php endforeach; ?>
|
279 |
+
<td class="cell-disable"><input type="hidden" /> </td>
|
280 |
+
<td class="cell-remove last"><input type="hidden" /> </td>
|
281 |
+
</tr>
|
282 |
+
</tbody>
|
283 |
+
<?php if (!$_block->getElement()->getReadonly()):?>
|
284 |
+
<tfoot>
|
285 |
+
<tr>
|
286 |
+
<td colspan="100" class="last" style="padding:8px">
|
287 |
+
<?php echo $_block->getUploaderHtml() ?>
|
288 |
+
</td>
|
289 |
+
</tr>
|
290 |
+
</tfoot>
|
291 |
+
<?php endif;?>
|
292 |
+
</table>
|
293 |
+
</div>
|
294 |
+
</div>
|
295 |
+
<input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save" name="<?php echo $_block->getElement()->getName() ?>[images]" value="<?php echo $_block->escapeHtml($_block->getImagesJson()) ?>" />
|
296 |
+
<input type="hidden" id="<?php echo $_block->getHtmlId() ?>_save_image" name="<?php echo $_block->getElement()->getName() ?>[values]" value="<?php echo $_block->escapeHtml($_block->getImagesValuesJson()) ?>" />
|
297 |
+
<script type="text/javascript">
|
298 |
+
//<![CDATA[
|
299 |
+
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php if ($_block->getElement()->getReadonly()):?>null<?php else:?><?php echo $_block->getUploader()->getJsObjectName() ?><?php endif;?>, <?php echo $_block->getImageTypesJson() ?>);
|
300 |
+
//]]>
|
301 |
+
</script>
|
302 |
+
<div id="loading-malabi" style=" display: none;">
|
303 |
+
<p class="loader" id="loading_mask_loader"><img src="http://ec2-54-82-245-66.compute-1.amazonaws.com:80/skin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="Loading..." pagespeed_url_hash="1122265435" onload="pagespeed.CriticalImages.checkImageForCriticality(this);"><br>Please wait...</p>
|
304 |
+
</div>
|
305 |
+
<div id="malabiparent">
|
306 |
+
<div id="modal1" class="modal modal-wider" style="margin-bottom: -8px;display: none;">
|
307 |
+
<div class="modal-content" style="padding-top: 20px;padding-bottom: 5px;background-color: #393b4b;">
|
308 |
+
|
309 |
+
<div style="font-family: Roboto, sans-serif; font-size: 24px; color: white;margin-bottom: 15px;margin-left: 10px">Background Remover Edit
|
310 |
+
</div>
|
311 |
+
<button id="camera51-btn-mark-object" class="waves-effect waves-light btn-flat roboto tooltipped"
|
312 |
+
data-position="bottom" data-delay="50" title="Draw lines to mark areas you want to keep in the image"
|
313 |
+
style="color:#7cb342;font-size: 14px;padding-right: 10px; padding-left: 10px;background: inherit;border: 0px;" onclick="camera51.setColor('colorFG');">
|
314 |
+
<i class="material-icons left" style="color:#7cb342;padding-right: 0px;margin-right: 10px;font-size: 24px;margin-top: -4px;">add_circle</i>
|
315 |
+
Mark Object
|
316 |
+
</button>
|
317 |
+
<button id="camera51-btn-mark-background" class="waves-effect waves-light btn-flat roboto tooltipped"
|
318 |
+
data-position="bottom" data-delay="50" title="Draw lines to mark areas you want to remove from the image"
|
319 |
+
style="margin-left:10px;color:#f44336;font-size: 14px;padding-right: 10px; padding-left: 10px; background: inherit;border: 0px;" onclick="camera51.setColor('colorBG');">
|
320 |
+
<i class="material-icons left" style="color:#f44336;padding-right: 0px;margin-right: 10px;font-size: 24px;margin-top: -4px;">remove_circle</i>
|
321 |
+
Mark Background
|
322 |
+
</button>
|
323 |
+
<button id="camera51-btn-undo" class="waves-effect waves-light btn-flat roboto" style="color: white;font-size: 14px;background: inherit;border: 0px;"
|
324 |
+
onclick="camera51.undo()">UNDO</button>
|
325 |
+
<br>
|
326 |
+
<a id="camera51-zoom-in" class="waves-effect waves-circle transparent"
|
327 |
+
style="position: absolute;top: 141px;left: 36px" onmousedown="camera51.onclickLongZoomIn()"
|
328 |
+
onmouseup="camera51.onmouseupLongZoomIn()">
|
329 |
+
<i class="material-icons right small zoomRippel" style="color:#393b4b;">zoom_in</i>
|
330 |
+
</a>
|
331 |
+
<a id="camera51-zoom-out" class="waves-effect waves-circle transparent"
|
332 |
+
style="position: absolute;top: 194px;left: 36px" onmousedown="camera51.onclickLongZoomOut()"
|
333 |
+
onmouseup="camera51.onmouseupLongZoomOut()">
|
334 |
+
<i class="material-icons right small zoomRippel" style="color:#393b4b;">zoom_out</i>
|
335 |
+
</a>
|
336 |
+
</div>
|
337 |
+
<div class="progress" style="margin: 0px;visibility: hidden;height: 3px" id="camera51-loader">
|
338 |
+
<div class="indeterminate"></div>
|
339 |
+
</div>
|
340 |
+
<div>
|
341 |
+
<div id="camera51Iframe" style="height:500px;width:100%"></div>
|
342 |
+
</div>
|
343 |
+
<div class="modal-footer" style="margin-top: 25px">
|
344 |
+
<input type="checkbox" class="filled-in" id="camera51-show-transparent" />
|
345 |
+
<label for="camera51-show-transparent" style="top: 23px;left: 20px; padding-left: 3px; padding-right: 14px;" onclick="camera51.backToEdit();window.ga('send', 'event', 'Site','btn transparent', 'editor')">Transparent</label>
|
346 |
+
<input type="checkbox" class="filled-in" id="camera51-show-shadow" style="" />
|
347 |
+
<label for="camera51-show-shadow" style="top: 23px;left: 42px; padding-left: 3px;" onclick="camera51.backToEdit();window.ga('send', 'event', 'Site','btn shadow', 'editor')">Remove shadow</label>
|
348 |
+
<button id="camera51-btn-save-image" class=" btn white-text waves-light btn-flat btn-large malabiBG "
|
349 |
+
onclick="camera51.saveImage()"
|
350 |
+
style="font-size: 17px;margin-right: 9px; margin-left: 23px; float: right;">Save Changes</button>
|
351 |
+
<button id="camera51-btn-show-result" class="waves-effect waves-teal btn-flat btn "
|
352 |
+
style="font-size: 17px; margin-left: 10px; float: right;"
|
353 |
+
onclick="camera51.showResult()">preview result</button>
|
354 |
+
</div>
|
355 |
+
</div>
|
356 |
+
</div>
|
357 |
+
<script type='text/javascript' src='//d8tv8no6fkiw3.cloudfront.net/website/assets/camera51.js?ver=1.0.0'></script>
|
358 |
+
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons" type="text/css" />
|
app/design/adminhtml/default/default/template/malabi/urls.phtml
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$model = Mage::getModel('productclick/productclick')->load(1);
|
3 |
+
$userid = $model->getUserid();
|
4 |
+
$token = $model->getToken();
|
5 |
+
|
6 |
+
|
7 |
+
?>
|
8 |
+
<form id="edit_form" action="<?php echo $this->getUrl('*/*/subscription', array('id' => 1)); ?>" method="post" enctype="multipart/form-data"><div><input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"></div>
|
9 |
+
|
10 |
+
<div class="entry-edit-head">
|
11 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Automatic Image Background Remover by Malabi</h4>
|
12 |
+
<div class="form-buttons"></div>
|
13 |
+
|
14 |
+
<table cellspacing="0" style="width:94%; padding: 25px;" class="form-list">
|
15 |
+
<tr>
|
16 |
+
<td class="value"><input id="save" name="save" onclick="clickme();" value="Subscription Information" class="submit_button submit" type="button"></td>
|
17 |
+
<td class="value">
|
18 |
+
<input id="cancel" name="cancel" onclick="clickme();" value="Cancel Subscription" class="submit_button" type="button"> </td>
|
19 |
+
</tr>
|
20 |
+
</table>
|
21 |
+
|
22 |
+
|
23 |
+
</div>
|
24 |
+
<div class="fieldset " id="productclick_form">
|
25 |
+
<div class="hor-scroll">
|
26 |
+
<table cellspacing="0" class="form-list">
|
27 |
+
<tbody>
|
28 |
+
|
29 |
+
<tr>
|
30 |
+
<td class="label"><label for="userid">User Id <span class="required">*</span></label></td>
|
31 |
+
<td class="value">
|
32 |
+
<input id="userid" name="userid" value="<?php echo $userid; ?>" class="required-entry input-text required-entry" type="text"> </td>
|
33 |
+
</tr>
|
34 |
+
<tr>
|
35 |
+
<td class="label"><label for="token">Token <span class="required">*</span></label></td>
|
36 |
+
<td class="value">
|
37 |
+
<input id="token" name="token" value="<?php echo $token; ?>" class="required-entry input-text required-entry" type="text">
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
<style> .entry-edit { width: 48%; background: #fff; margin: auto; -moz-box-shadow: 3px 3px 5px 6px #ccc;
|
42 |
+
-webkit-box-shadow: 3px 3px 5px 6px #ccc;
|
43 |
+
box-shadow: 3px 3px 5px 6px #ccc; padding: 50px; min-height: 250px; }
|
44 |
+
.entry-edit .entry-edit-head { padding: 2px 10px; background: #fff; border-bottom:1px solid #d6d6d6; }
|
45 |
+
|
46 |
+
.entry-edit .entry-edit-head h4 { color:#333 !important; font-size: 2em; line-height: 36px; }
|
47 |
+
|
48 |
+
.box, .entry-edit fieldset, .entry-edit .fieldset { border: none !important; background: #fff !important;}
|
49 |
+
.content-header { display:none; }
|
50 |
+
.submit_button { background-color: #e7e7e7; color: black;
|
51 |
+
border: 1px solid #d6d6d6;
|
52 |
+
cursor: pointer;
|
53 |
+
padding: 15px 32px;
|
54 |
+
text-align: center;
|
55 |
+
text-decoration: none;
|
56 |
+
display: inline-block;
|
57 |
+
font-size: 16px;}
|
58 |
+
|
59 |
+
.submit_button:hover { background-color: #f4f5f5; }
|
60 |
+
|
61 |
+
.form-list td.value input.input-text, .form-list td.value textarea { width: 220px; padding: 5px;}
|
62 |
+
#messages { width: 46%; margin: auto; }
|
63 |
+
</style> </td>
|
64 |
+
</tr>
|
65 |
+
<tr>
|
66 |
+
<td class="label"></td>
|
67 |
+
<td class="value">
|
68 |
+
</td>
|
69 |
+
</tr>
|
70 |
+
</tbody>
|
71 |
+
</table>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
</form>
|
75 |
+
|
76 |
+
<script>
|
77 |
+
var malabi_userId = "<?php echo $userid; ?>";
|
78 |
+
var malabi_userToken = "<?php echo $token; ?>";
|
79 |
+
|
80 |
+
Event.observe(window, "load", function() {
|
81 |
+
|
82 |
+
// if(malabi_userId == ''){
|
83 |
+
// console.log(malabi_userId);
|
84 |
+
// Dialog.confirm($('requestemail').innerHTML, {className:"alphacube", width:400,
|
85 |
+
// okLabel: "login", cancelLabel: "cancel",
|
86 |
+
// onOk:function(win){
|
87 |
+
// $('login_error_msg').innerHTML='Login or password inccorect';
|
88 |
+
// $('login_error_msg').show();
|
89 |
+
// Windows.focusedWindow.updateHeight();
|
90 |
+
// new Effect.Shake(Windows.focusedWindow.getId()); return false;
|
91 |
+
// }
|
92 |
+
// });
|
93 |
+
// }
|
94 |
+
|
95 |
+
|
96 |
+
});
|
97 |
+
|
98 |
+
function clickme()
|
99 |
+
{
|
100 |
+
url = 'http://sandbox.users.malabi.co/UsersServer/web/subscribeUser?userId=<?php echo $userid; ?>&userToken=<?php echo $token; ?>';
|
101 |
+
var newtab = window.open( '', '_blank' );
|
102 |
+
newtab.location = url;
|
103 |
+
|
104 |
+
}
|
105 |
+
|
106 |
+
</script>
|
107 |
+
|
108 |
+
<div id="requestemail" style="display:none">
|
109 |
+
<p><span id='login_error_msg' class="login_error" style="display:none"> </span></p>
|
110 |
+
<div style="clear:both"></div>
|
111 |
+
<p>There was a problem in creating an account. To create an account for Background Removal, please probide email and password. </p>
|
112 |
+
<p><span class="login_label">login</span> <span class="login_input"><input type="text"/></span></p>
|
113 |
+
<div style="clear:both"></div>
|
114 |
+
<p><span class="login_label">password</span> <span class="login_input"><input type="password"/></span></p>
|
115 |
+
<div style="clear:both"></div>
|
116 |
+
</div>
|
app/etc/modules/Camera_Malabi.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Camera_Malabi>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
</Camera_Malabi>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Camera_Malabi</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="https://www.malabi.co/eula/">GPL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Automatically remove the background from any image. Grow Sales and make your store look great with Malabi.</summary>
|
10 |
+
<description>Image Background Remover by Malabi
|
11 |
+

|
12 |
+
Remove background from multiple images in seconds with Malabi. 
|
13 |
+

|
14 |
+
The automatic image background remover by Malabi will quickly remove the background from any product photo. Our patented technology does all the work for you. 
|
15 |
+

|
16 |
+
When selling a product online, image quality is crucial. A professional looking image means higher conversion rates. 
|
17 |
+
Malabi is a fast, simple and cost effective solution for Magento seller’s needs. 
|
18 |
+

|
19 |
+
When entering the app, our algorithm automatically removes the backgrounds and delivers studio quality product images to all of your Magento uploaded photos. Once you view the outcome you decide which enhanced images to add to your product listings. 
|
20 |
+

|
21 |
+
If the automatically enhanced image is not good enough for you, you can always manually edit the outcome by using the 'Touch up’ mode. </description>
|
22 |
+
<notes>login and out</notes>
|
23 |
+
<authors><author><name>Camera</name><user>Malabi</user><email>info@malabi.co</email></author></authors>
|
24 |
+
<date>2017-03-14</date>
|
25 |
+
<time>13:09:23</time>
|
26 |
+
<contents><target name="magelocal"><dir name="Camera"><dir name="Malabi"><dir name="Block"><dir name="Adminhtml"><dir name="Productclick"><dir name="Edit"><file name="Form.php" hash="d123f3e614dbea83917283162163c713"/><dir name="Renderer"><file name="Urls.php" hash="dff3ec0ca9b46977f9544498b6ae8532"/></dir></dir><file name="Edit.php" hash="fa6562d8bb6ef549b4c585cfd55ee350"/></dir><file name="Productclick.php" hash="0b08e8a9e55910e35ec3fa00f10ff1f4"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2bc4e4b0706da3774cb7248c12d150c7"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Productclick"><file name="Collection.php" hash="b94110ec7a16a54e2b9e50724f83da47"/></dir><file name="Productclick.php" hash="890d56f493c01d964a7b629bf6a4e322"/></dir><file name="Observer.php" hash="4629e9d62d4648b27e550534b047276e"/><file name="Productclick.php" hash="ef0cf5873bf9947eb2aa45b3f50212ed"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductclickController.php" hash="f0d7345cb71b68deedf13964ce75582b"/></dir><file name="ProductController.php" hash="68f7818f76317fd3d3eac6446adc0bcf"/></dir><dir name="etc"><file name="config.xml" hash="c5f55d8a8842ffb53efdf64a045c6983"/></dir><dir name="sql"><dir name="productclick_setup"><file name="mysql4-install-0.1.0.php" hash="bdf82a0397e524ac47f20179bdd0f9d2"/></dir></dir></dir></dir><dir name="Mage"><dir name="Adminhtml"><dir name="Block"><dir name="Catalog"><dir name="Product"><dir name="Helper"><dir name="Form"><dir name="Gallery"><file name="Content.php" hash="214e148885166f36bf4126d11ebc1da8"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Camera_Malabi.xml" hash="da762d589eddd255b0a522081c2f958c"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="productclick.xml" hash="579ea5b43a32dfafaec53096c2ec292e"/></dir><dir name="template"><dir name="catalog"><dir name="product"><dir name="helper"><file name="gallery-new.phtml" hash="b4c8a4fb50f92019a07316c28b258891"/></dir></dir></dir><dir name="malabi"><file name="urls.phtml" hash="d688a86e160637226531869c54ccdcbf"/></dir></dir></dir></dir></dir></target></contents>
|
27 |
+
<compatible/>
|
28 |
+
<dependencies><required><php><min>5.3.1</min><max>5.6.1</max></php></required></dependencies>
|
29 |
+
</package>
|