Version Notes
All new "Order translations by category" feature
Download this release
Release Info
| Developer | Transfluent Ltd |
| Extension | Transfluent |
| Version | 1.3.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.2.5 to 1.3.0
- app/code/community/Transfluent/Translate/Block/Adminhtml/Transfluentorder.php +1 -1
- app/code/community/Transfluent/Translate/Helper/Category.php +19 -12
- app/code/community/Transfluent/Translate/Model/Base/Backendclient.php +52 -6
- app/code/community/Transfluent/Translate/controllers/Adminhtml/TransfluentorderController.php +146 -3
- app/code/community/Transfluent/Translate/controllers/Adminhtml/TransfluenttranslateController.php +1 -1
- app/code/community/Transfluent/Translate/controllers/TranslationController.php +152 -3
- app/code/community/Transfluent/Translate/etc/config.xml +3 -3
- app/code/community/Transfluent/Translate/etc/system.xml +1 -1
- app/design/adminhtml/default/default/template/transfluent/order/{order.phtml → category_step1.phtml} +127 -1
- app/design/adminhtml/default/default/template/transfluent/order/category_step2.phtml +52 -0
- app/design/adminhtml/default/default/template/transfluent/order/category_step3.phtml +128 -0
- app/design/adminhtml/default/default/template/transfluent/order/category_step4.phtml +59 -0
- app/design/adminhtml/default/default/template/transfluent/order/category_step5.phtml +57 -0
- package.xml +6 -6
app/code/community/Transfluent/Translate/Block/Adminhtml/Transfluentorder.php
CHANGED
|
@@ -13,7 +13,7 @@ class Transfluent_Translate_Block_Adminhtml_Transfluentorder extends Mage_Adminh
|
|
| 13 |
$this->removeButton('add');
|
| 14 |
$this->addButton('order_reorder', array(
|
| 15 |
'label' => Mage::helper('sales')->__('Get Quote'),
|
| 16 |
-
'onclick' => 'setLocation(\'' . $this->getUrl('transfluent/adminhtml_transfluentorder/
|
| 17 |
|
| 18 |
//$this->removeButton('save');
|
| 19 |
$this->_updateButton('save', 'label', 'Place order');
|
| 13 |
$this->removeButton('add');
|
| 14 |
$this->addButton('order_reorder', array(
|
| 15 |
'label' => Mage::helper('sales')->__('Get Quote'),
|
| 16 |
+
'onclick' => 'setLocation(\'' . $this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep1') . '\')',));
|
| 17 |
|
| 18 |
//$this->removeButton('save');
|
| 19 |
$this->_updateButton('save', 'label', 'Place order');
|
app/code/community/Transfluent/Translate/Helper/Category.php
CHANGED
|
@@ -82,39 +82,46 @@ class Transfluent_Translate_Helper_Category extends Mage_Core_Helper_Abstract {
|
|
| 82 |
/**
|
| 83 |
* get checkbox html of categories
|
| 84 |
*
|
|
|
|
|
|
|
| 85 |
* @return string
|
| 86 |
*/
|
| 87 |
-
public function getCategoriesHTML() {
|
| 88 |
-
$category_ids
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
| 90 |
return $html;
|
| 91 |
}
|
| 92 |
|
| 93 |
/**
|
| 94 |
-
* @param
|
|
|
|
|
|
|
| 95 |
* @return string
|
| 96 |
*/
|
| 97 |
-
private function categoryArrayToHtml($category_ids, &$visited = array()) {
|
| 98 |
ini_set('memory_limit', '128M');
|
| 99 |
set_time_limit(0);
|
| 100 |
|
| 101 |
$html = "<ul style=\"margin-left: 15px\">";
|
| 102 |
-
foreach ($category_ids AS $
|
| 103 |
-
if (in_array($
|
| 104 |
-
$visited[] = $
|
| 105 |
/** @var Mage_Catalog_Model_Category $cat */
|
| 106 |
$cat = Mage::getModel('catalog/category');
|
| 107 |
-
$cat->load($
|
| 108 |
if (!$cat->getName()) {
|
| 109 |
continue;
|
| 110 |
}
|
| 111 |
$html .= "<li>";
|
| 112 |
-
$html .= "<label><input type='checkbox' name='chk_group[]' value=" . $
|
| 113 |
-
|
| 114 |
|
| 115 |
$cat_children_ids = $cat->getAllChildren(true);
|
| 116 |
if (!empty($cat_children_ids)) {
|
| 117 |
-
$html .= $this->categoryArrayToHtml($cat_children_ids, $visited);
|
| 118 |
}
|
| 119 |
unset($cat_children_ids);
|
| 120 |
|
| 82 |
/**
|
| 83 |
* get checkbox html of categories
|
| 84 |
*
|
| 85 |
+
* @param array - category ids
|
| 86 |
+
* @param array
|
| 87 |
* @return string
|
| 88 |
*/
|
| 89 |
+
public function getCategoriesHTML($category_ids = null, $selected_ids = array()) {
|
| 90 |
+
if (is_null($category_ids)) {
|
| 91 |
+
$category_ids = $this->getCategoryIdsArray();
|
| 92 |
+
}
|
| 93 |
+
$visited = array();
|
| 94 |
+
$html = $this->categoryArrayToHtml($category_ids, $visited, $selected_ids);
|
| 95 |
return $html;
|
| 96 |
}
|
| 97 |
|
| 98 |
/**
|
| 99 |
+
* @param array
|
| 100 |
+
* @param array
|
| 101 |
+
* @param array
|
| 102 |
* @return string
|
| 103 |
*/
|
| 104 |
+
private function categoryArrayToHtml($category_ids, &$visited = array(), $selected_ids = array()) {
|
| 105 |
ini_set('memory_limit', '128M');
|
| 106 |
set_time_limit(0);
|
| 107 |
|
| 108 |
$html = "<ul style=\"margin-left: 15px\">";
|
| 109 |
+
foreach ($category_ids AS $category_id) {
|
| 110 |
+
if (in_array($category_id, $visited)) continue;
|
| 111 |
+
$visited[] = $category_id;
|
| 112 |
/** @var Mage_Catalog_Model_Category $cat */
|
| 113 |
$cat = Mage::getModel('catalog/category');
|
| 114 |
+
$cat->load($category_id);
|
| 115 |
if (!$cat->getName()) {
|
| 116 |
continue;
|
| 117 |
}
|
| 118 |
$html .= "<li>";
|
| 119 |
+
$html .= "<label><input type='checkbox' name='chk_group[]' " . (in_array($category_id, $selected_ids) ? 'checked="checked"' : '') . " value=" . $category_id . " /> " . $cat->getName() . '<br>';
|
| 120 |
+
//. " (" . $cat->getProductCount() . ")" . "<br>";
|
| 121 |
|
| 122 |
$cat_children_ids = $cat->getAllChildren(true);
|
| 123 |
if (!empty($cat_children_ids)) {
|
| 124 |
+
$html .= $this->categoryArrayToHtml($cat_children_ids, $visited, $selected_ids);
|
| 125 |
}
|
| 126 |
unset($cat_children_ids);
|
| 127 |
|
app/code/community/Transfluent/Translate/Model/Base/Backendclient.php
CHANGED
|
@@ -122,12 +122,14 @@ class Transfluent_Translate_Model_Base_Backendclient extends Mage_Adminhtml_Cont
|
|
| 122 |
}
|
| 123 |
|
| 124 |
public function Logout() {
|
| 125 |
-
// @todo: Notify API about logout
|
| 126 |
return $this->SaveConfiguration(null, null);
|
| 127 |
}
|
| 128 |
|
| 129 |
-
public function Authenticate($
|
| 130 |
-
$
|
|
|
|
|
|
|
|
|
|
| 131 |
$message = array();
|
| 132 |
if (!$response['response']['token']) {
|
| 133 |
throw new Exception('Could not authenticate with API!');
|
|
@@ -138,8 +140,8 @@ class Transfluent_Translate_Model_Base_Backendclient extends Mage_Adminhtml_Cont
|
|
| 138 |
} else {
|
| 139 |
$token = $response['response']['token'];
|
| 140 |
$this->token = $token;
|
| 141 |
-
$this->email = $
|
| 142 |
-
$this->SaveConfiguration($
|
| 143 |
$message['status'] = 'ok';
|
| 144 |
$message['message'] = 'You have successfully connected to Transfluent.com';
|
| 145 |
$session = Mage::getSingleton('core/session');
|
|
@@ -163,8 +165,52 @@ class Transfluent_Translate_Model_Base_Backendclient extends Mage_Adminhtml_Cont
|
|
| 163 |
return $this->CallApi(__FUNCTION__, self::HTTP_GET, array('name' => 'tests'));
|
| 164 |
}
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
public function CreateAccount($email, $terms) {
|
| 167 |
-
$
|
|
|
|
|
|
|
|
|
|
| 168 |
if ($res['status'] == "OK") {
|
| 169 |
$this->SaveConfiguration($email, $res['response']['token']);
|
| 170 |
$session = Mage::getSingleton('core/session');
|
| 122 |
}
|
| 123 |
|
| 124 |
public function Logout() {
|
|
|
|
| 125 |
return $this->SaveConfiguration(null, null);
|
| 126 |
}
|
| 127 |
|
| 128 |
+
public function Authenticate($email, $password) {
|
| 129 |
+
$extension_callback_endpoint = Mage::getUrl('transfluenttranslate/');
|
| 130 |
+
$version = Mage::getVersion();
|
| 131 |
+
$payload = array('email' => $email, 'password' => $password, 'magento_ver' => $version, 'magento_url' => $extension_callback_endpoint);
|
| 132 |
+
$response = $this->Request(__FUNCTION__, 'POST', $payload);
|
| 133 |
$message = array();
|
| 134 |
if (!$response['response']['token']) {
|
| 135 |
throw new Exception('Could not authenticate with API!');
|
| 140 |
} else {
|
| 141 |
$token = $response['response']['token'];
|
| 142 |
$this->token = $token;
|
| 143 |
+
$this->email = $email;
|
| 144 |
+
$this->SaveConfiguration($email, $token);
|
| 145 |
$message['status'] = 'ok';
|
| 146 |
$message['message'] = 'You have successfully connected to Transfluent.com';
|
| 147 |
$session = Mage::getSingleton('core/session');
|
| 165 |
return $this->CallApi(__FUNCTION__, self::HTTP_GET, array('name' => 'tests'));
|
| 166 |
}
|
| 167 |
|
| 168 |
+
public function GetCategoryQuote($quote_id) {
|
| 169 |
+
$payload = array(
|
| 170 |
+
'id' => $quote_id,
|
| 171 |
+
'token' => $this->token
|
| 172 |
+
);
|
| 173 |
+
return $this->CallApi('magento/quote', self::HTTP_GET, $payload);
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
public function OrderCategoryQuote($quote_id, $instructions) {
|
| 177 |
+
$payload = array(
|
| 178 |
+
'id' => $quote_id,
|
| 179 |
+
'token' => $this->token,
|
| 180 |
+
'order' => true,
|
| 181 |
+
'method' => 'PUT',
|
| 182 |
+
'__fork' => 1
|
| 183 |
+
);
|
| 184 |
+
return $this->CallApi('magento/quote', self::HTTP_POST, $payload);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
public function CreateCategoryQuote($source_store, $source_language, $target_store, $target_language, $level, $collision_strategy, $category_ids, $translate_fields = null) {
|
| 188 |
+
$extension_callback_endpoint = Mage::getUrl('transfluenttranslate/');
|
| 189 |
+
$version = Mage::getVersion();
|
| 190 |
+
$payload = array(
|
| 191 |
+
'magento_ver' => $version,
|
| 192 |
+
'magento_url' => $extension_callback_endpoint,
|
| 193 |
+
'source_store' => $source_store,
|
| 194 |
+
'source_language' => $source_language,
|
| 195 |
+
'target_store' => $target_store,
|
| 196 |
+
'target_language' => $target_language,
|
| 197 |
+
'level' => $level,
|
| 198 |
+
'collision' => $collision_strategy,
|
| 199 |
+
'category_ids' => '[' . implode(",", $category_ids) . ']',
|
| 200 |
+
'token' => $this->token,
|
| 201 |
+
'hash' => md5($this->token)
|
| 202 |
+
);
|
| 203 |
+
if (!is_null($translate_fields)) {
|
| 204 |
+
$payload['translate_fields'] = $translate_fields;
|
| 205 |
+
}
|
| 206 |
+
return $this->CallApi('magento/quote', self::HTTP_POST, $payload);
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
public function CreateAccount($email, $terms) {
|
| 210 |
+
$extension_callback_endpoint = Mage::getUrl('transfluenttranslate/');
|
| 211 |
+
$version = Mage::getVersion();
|
| 212 |
+
$payload = array('email' => $email, 'terms' => $terms, 'magento_ver' => $version, 'magento_url' => $extension_callback_endpoint);
|
| 213 |
+
$res = $this->CallApi(__FUNCTION__, self::HTTP_GET, $payload);
|
| 214 |
if ($res['status'] == "OK") {
|
| 215 |
$this->SaveConfiguration($email, $res['response']['token']);
|
| 216 |
$session = Mage::getSingleton('core/session');
|
app/code/community/Transfluent/Translate/controllers/Adminhtml/TransfluentorderController.php
CHANGED
|
@@ -98,7 +98,7 @@ class Transfluent_Translate_Adminhtml_TransfluentorderController extends Mage_Ad
|
|
| 98 |
return false;
|
| 99 |
}
|
| 100 |
|
| 101 |
-
$instructions = $this->getRequest()->getParam('instructions') ? : '';
|
| 102 |
$level = intval($this->getRequest()->getParam('level'));
|
| 103 |
$store_from_id = intval($this->getRequest()->getParam('from_store'));
|
| 104 |
$store_to_id = intval($this->getRequest()->getParam('to_store'));
|
|
@@ -387,18 +387,161 @@ class Transfluent_Translate_Adminhtml_TransfluentorderController extends Mage_Ad
|
|
| 387 |
}
|
| 388 |
}
|
| 389 |
|
| 390 |
-
public function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
$this->_initAction();
|
| 392 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
$this->_addContent(
|
| 394 |
$this
|
| 395 |
->getLayout()
|
| 396 |
->createBlock('transfluenttranslate/adminhtml_transfluentorder')
|
| 397 |
-
->setTemplate('transfluent/order/
|
| 398 |
);
|
| 399 |
$this->renderLayout();
|
| 400 |
}
|
| 401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
public function formAction() {
|
| 403 |
$this->loadLayout();
|
| 404 |
$this->getResponse()->setBody(
|
| 98 |
return false;
|
| 99 |
}
|
| 100 |
|
| 101 |
+
$instructions = $this->getRequest()->getParam('instructions') ? $this->getRequest()->getParam('instructions') : '';
|
| 102 |
$level = intval($this->getRequest()->getParam('level'));
|
| 103 |
$store_from_id = intval($this->getRequest()->getParam('from_store'));
|
| 104 |
$store_to_id = intval($this->getRequest()->getParam('to_store'));
|
| 387 |
}
|
| 388 |
}
|
| 389 |
|
| 390 |
+
public function orderByCategoryStep5Action($init_layout = true) {
|
| 391 |
+
if ($init_layout) {
|
| 392 |
+
$this->_initAction();
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
/** @var Transfluent_Translate_Model_Base_Backendclient $translate */
|
| 396 |
+
$translate = Mage::getModel('transfluenttranslate/base_backendclient');
|
| 397 |
+
$quote_id = $this->getRequest()->getParam('quote_id');
|
| 398 |
+
$instructions = $this->getRequest()->getParam('instructions');
|
| 399 |
+
|
| 400 |
+
$data = $translate->OrderCategoryQuote($quote_id, $instructions);
|
| 401 |
+
if (!$data || $data['status'] != 'OK') {
|
| 402 |
+
$this->getLayout()->getMessagesBlock()->addError('Failed to place the order. Error: ' . @$data['error']['message']);
|
| 403 |
+
$this->orderByCategoryStep3Action(false);
|
| 404 |
+
return;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
/*
|
| 408 |
+
if (!isset($data['response']['status_code']) || $data['response']['status_code'] != 3) {
|
| 409 |
+
$this->getLayout()->getMessagesBlock()->addError('Something unexpected happened while processing the order. Please contact support@transfluent.com to resolve the situation.');
|
| 410 |
+
$this->orderByCategoryStep3Action(false);
|
| 411 |
+
return;
|
| 412 |
+
}*/
|
| 413 |
+
|
| 414 |
+
$this->_addContent(
|
| 415 |
+
$this
|
| 416 |
+
->getLayout()
|
| 417 |
+
->createBlock('transfluenttranslate/adminhtml_transfluentorder')
|
| 418 |
+
->setTemplate('transfluent/order/category_step5.phtml')->setData('fork_id', $data['response'])->setData('quote_id', $quote_id)
|
| 419 |
+
);
|
| 420 |
+
$this->renderLayout();
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
public function orderByCategoryStep4Action($init_layout = true) {
|
| 424 |
+
if ($init_layout) {
|
| 425 |
+
$this->_initAction();
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
$this->_addContent(
|
| 429 |
+
$this
|
| 430 |
+
->getLayout()
|
| 431 |
+
->createBlock('transfluenttranslate/adminhtml_transfluentorder')
|
| 432 |
+
->setTemplate('transfluent/order/category_step4.phtml')
|
| 433 |
+
);
|
| 434 |
+
$this->renderLayout();
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
public function orderByCategoryStep1Action($init_layout = true) {
|
| 438 |
+
if ($init_layout) {
|
| 439 |
+
$this->_initAction();
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
if (!Mage::getStoreConfig('transfluenttranslate/account/token')) {
|
| 443 |
+
$login_url = Mage::helper("adminhtml")->getUrl("adminhtml/system_config/edit", array('section' => 'transfluenttranslate'));
|
| 444 |
+
$this->getLayout()->getMessagesBlock()->addError('Please login or create an account <a href="' . $login_url . '">first</a>!');
|
| 445 |
+
}
|
| 446 |
+
$this->_addContent(
|
| 447 |
+
$this
|
| 448 |
+
->getLayout()
|
| 449 |
+
->createBlock('transfluenttranslate/adminhtml_transfluentorder')
|
| 450 |
+
->setTemplate('transfluent/order/category_step1.phtml')
|
| 451 |
+
);
|
| 452 |
+
$this->renderLayout();
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
public function orderByCategoryStep2Action() {
|
| 456 |
$this->_initAction();
|
| 457 |
|
| 458 |
+
$target = $this->getRequest()->getParam('target');
|
| 459 |
+
if (!$target) {
|
| 460 |
+
$this->getLayout()->getMessagesBlock()->addError('Please select a target language&store for translations!');
|
| 461 |
+
$this->orderByCategoryStep1Action(false);
|
| 462 |
+
return;
|
| 463 |
+
}
|
| 464 |
+
$source = $this->getRequest()->getParam('source');
|
| 465 |
+
if ($source == $target) {
|
| 466 |
+
$this->getLayout()->getMessagesBlock()->addError('You can not translate into the source store as each store may have only one locale. You need a pair of stores in different languages, please refer our getting started guide for Magento to do that.');
|
| 467 |
+
$this->orderByCategoryStep1Action(false);
|
| 468 |
+
return;
|
| 469 |
+
}
|
| 470 |
+
$source_store = Mage::app()->getStore($source);
|
| 471 |
+
$target_store = Mage::app()->getStore($target);
|
| 472 |
+
if ($source_store->getRootCategoryId() != $target_store->getRootCategoryId()) {
|
| 473 |
+
$this->getLayout()->getMessagesBlock()->addError('The source store and target store MUST have a common root category!');
|
| 474 |
+
$this->orderByCategoryStep1Action(false);
|
| 475 |
+
return;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
$this->_addContent(
|
| 479 |
$this
|
| 480 |
->getLayout()
|
| 481 |
->createBlock('transfluenttranslate/adminhtml_transfluentorder')
|
| 482 |
+
->setTemplate('transfluent/order/category_step2.phtml')
|
| 483 |
);
|
| 484 |
$this->renderLayout();
|
| 485 |
}
|
| 486 |
|
| 487 |
+
public function orderByCategoryStep3Action($init_layout = true) {
|
| 488 |
+
/** @var Transfluent_Translate_Model_Base_Backendclient $translate */
|
| 489 |
+
$translate = Mage::getModel('transfluenttranslate/base_backendclient');
|
| 490 |
+
$quote_id = $this->getRequest()->getParam('quote_id');
|
| 491 |
+
|
| 492 |
+
if ($quote_id && $this->getRequest()->getParam('isAjax')) {
|
| 493 |
+
$data = $translate->GetCategoryQuote($quote_id);
|
| 494 |
+
$this->getResponse()
|
| 495 |
+
->setBody(
|
| 496 |
+
Mage::helper('core')->jsonEncode($data['response']))
|
| 497 |
+
->setHttpResponseCode(200)
|
| 498 |
+
->setHeader('Content-type', 'application/json', true);
|
| 499 |
+
return;
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
if ($init_layout) {
|
| 503 |
+
// Preserve any pre-generated errors
|
| 504 |
+
$this->_initAction();
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
$target = $this->getRequest()->getParam('target');
|
| 508 |
+
$source = $this->getRequest()->getParam('source');
|
| 509 |
+
$source_store = Mage::app()->getStore($source);
|
| 510 |
+
$target_store = Mage::app()->getStore($target);
|
| 511 |
+
$level = $this->getRequest()->getParam('level');
|
| 512 |
+
$collision_strategy = $this->getRequest()->getParam('collision');
|
| 513 |
+
|
| 514 |
+
$categories = $this->getRequest()->getParam('chk_group');
|
| 515 |
+
if (empty($categories)) {
|
| 516 |
+
$this->getLayout()->getMessagesBlock()->addError('Please select at least one category!');
|
| 517 |
+
$this->orderByCategoryStep2Action(false);
|
| 518 |
+
return;
|
| 519 |
+
}
|
| 520 |
+
|
| 521 |
+
if (!$quote_id) {
|
| 522 |
+
/** @var Transfluent_Translate_Helper_Languages $languageHelper */
|
| 523 |
+
$languageHelper = Mage::helper('transfluenttranslate/languages');
|
| 524 |
+
$source_store_locale_code = $languageHelper->GetStoreLocale($source_store->getCode());
|
| 525 |
+
$target_store_locale_code = $languageHelper->GetStoreLocale($target_store->getCode());
|
| 526 |
+
$data = $translate->CreateCategoryQuote($source, $source_store_locale_code, $target, $target_store_locale_code, $level, $collision_strategy, $this->getRequest()->getParam('chk_group'));
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
$block = $this->getLayout()->createBlock('transfluenttranslate/adminhtml_transfluentorder')->setTemplate('transfluent/order/category_step3.phtml');
|
| 530 |
+
|
| 531 |
+
if (!$quote_id && $data['status'] == 'ERROR') {
|
| 532 |
+
$block->setData('quote_id', null);
|
| 533 |
+
$this->getLayout()->getMessagesBlock()->addError($data['error']['message']);
|
| 534 |
+
} else if (!$quote_id) {
|
| 535 |
+
$quote_id = $data['response'];
|
| 536 |
+
$block->setData('quote_id', $quote_id);
|
| 537 |
+
} else {
|
| 538 |
+
$block->setData('quote_id', $quote_id);
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
$this->_addContent($block);
|
| 542 |
+
$this->renderLayout();
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
public function formAction() {
|
| 546 |
$this->loadLayout();
|
| 547 |
$this->getResponse()->setBody(
|
app/code/community/Transfluent/Translate/controllers/Adminhtml/TransfluenttranslateController.php
CHANGED
|
@@ -147,7 +147,7 @@ class Transfluent_Translate_Adminhtml_TransfluenttranslateController extends Mag
|
|
| 147 |
}
|
| 148 |
|
| 149 |
$e = new Transfluent_Translate_Exception_ETransfluentUnknownErrorNoEstimateBase();
|
| 150 |
-
$error_msg = $error_msg ? : $e->getMessage();
|
| 151 |
$this->_outputErrorJson($error_msg);
|
| 152 |
return false;
|
| 153 |
}
|
| 147 |
}
|
| 148 |
|
| 149 |
$e = new Transfluent_Translate_Exception_ETransfluentUnknownErrorNoEstimateBase();
|
| 150 |
+
$error_msg = $error_msg ? $error_msg : $e->getMessage();
|
| 151 |
$this->_outputErrorJson($error_msg);
|
| 152 |
return false;
|
| 153 |
}
|
app/code/community/Transfluent/Translate/controllers/TranslationController.php
CHANGED
|
@@ -17,6 +17,155 @@ class Transfluent_Translate_TranslationController extends Mage_Core_Controller_F
|
|
| 17 |
"/store\-([0-9]{1,})\-category\-([0-9]{1,})\-meta\-description/" => '_saveCategoryMetaDescription',
|
| 18 |
);
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
public function saveAction() {
|
| 21 |
try {
|
| 22 |
$this->_validateToken();
|
|
@@ -305,7 +454,7 @@ class Transfluent_Translate_TranslationController extends Mage_Core_Controller_F
|
|
| 305 |
/** @var Mage_Catalog_Model_Product_Action $product_action */
|
| 306 |
$product_action->updateAttributes(
|
| 307 |
array($product_id),
|
| 308 |
-
array((string)$field_name => $payload['text'] ? : ''),
|
| 309 |
$store_id);
|
| 310 |
|
| 311 |
return $this->_updateOrder($store_id, $text_id, $payload['level']);
|
|
@@ -319,9 +468,9 @@ class Transfluent_Translate_TranslationController extends Mage_Core_Controller_F
|
|
| 319 |
/** @var Transfluent_Translate_Model_Mysql4_Transfluenttranslate_Collection $order */
|
| 320 |
$order->setDataToAll('status', 2);
|
| 321 |
$order->save();
|
| 322 |
-
} else {
|
| 323 |
throw new Transfluent_Translate_Exception_EFailedToUpdateOrder();
|
| 324 |
-
}
|
| 325 |
return true;
|
| 326 |
}
|
| 327 |
}
|
| 17 |
"/store\-([0-9]{1,})\-category\-([0-9]{1,})\-meta\-description/" => '_saveCategoryMetaDescription',
|
| 18 |
);
|
| 19 |
|
| 20 |
+
private function serveRequest($payload) {
|
| 21 |
+
$status = true;
|
| 22 |
+
if ($payload instanceof Exception) {
|
| 23 |
+
$payload = array(
|
| 24 |
+
'status' => 'ERROR',
|
| 25 |
+
'error' => array(
|
| 26 |
+
'type' => get_class($payload),
|
| 27 |
+
'message' => $payload->getMessage()
|
| 28 |
+
)
|
| 29 |
+
);
|
| 30 |
+
$status = false;
|
| 31 |
+
}
|
| 32 |
+
$this->getResponse()
|
| 33 |
+
->setBody(
|
| 34 |
+
Mage::helper('core')->jsonEncode($payload))
|
| 35 |
+
->setHttpResponseCode($status === true ? 200 : 400)
|
| 36 |
+
->setHeader('Content-type', 'application/json', true);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
public function getProductIdsAction() {
|
| 40 |
+
try {
|
| 41 |
+
$this->_validateToken();
|
| 42 |
+
|
| 43 |
+
$category_id = $this->getRequest()->getParam('category_id');
|
| 44 |
+
$store = $this->getRequest()->getParam('store');
|
| 45 |
+
/** @var Mage_Catalog_Model_Category $cat */
|
| 46 |
+
$cat = Mage::getModel('catalog/category');
|
| 47 |
+
$cat->load($category_id);
|
| 48 |
+
$product_ids = array();
|
| 49 |
+
if ($cat->getProductCount() > 0) {
|
| 50 |
+
$model = Mage::getModel('catalog/product')->setStoreId($store);
|
| 51 |
+
/** @var Mage_Catalog_Model_Resource_Product_Collection $products */
|
| 52 |
+
$products = $model->getCollection();
|
| 53 |
+
$products->addStoreFilter($store);
|
| 54 |
+
$products->addCategoryFilter($cat);
|
| 55 |
+
$product_ids = $products->getAllIds();
|
| 56 |
+
}
|
| 57 |
+
$response = array(
|
| 58 |
+
'products' => $product_ids
|
| 59 |
+
);
|
| 60 |
+
} catch (Exception $e) {
|
| 61 |
+
$response = $e;
|
| 62 |
+
}
|
| 63 |
+
$this->serveRequest($response);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
public function getProductDetailsAction() {
|
| 67 |
+
try {
|
| 68 |
+
$this->_validateToken();
|
| 69 |
+
$product_ids_str = $this->getRequest()->getParam('product_ids');
|
| 70 |
+
$product_fields_str = $this->getRequest()->getParam('translate_fields');
|
| 71 |
+
$collision = $this->getRequest()->getParam('collision');
|
| 72 |
+
$product_ids = explode(",", $product_ids_str);
|
| 73 |
+
$product_fields = explode(",", $product_fields_str);
|
| 74 |
+
$target_store_id = $this->getRequest()->getParam('target_store');
|
| 75 |
+
$source_store_id = $this->getRequest()->getParam('source_store');
|
| 76 |
+
$product_model = Mage::getModel('catalog/product');
|
| 77 |
+
/** @var Mage_Catalog_Model_Product $model */
|
| 78 |
+
|
| 79 |
+
$available_fields = array();
|
| 80 |
+
$products_out = array();
|
| 81 |
+
foreach ($product_ids AS $product_id) {
|
| 82 |
+
$product = $product_model->setStoreId($target_store_id)->load($product_id);
|
| 83 |
+
if (!$product) {
|
| 84 |
+
continue;
|
| 85 |
+
}
|
| 86 |
+
/** @var Mage_Catalog_Model_Product $product */
|
| 87 |
+
if (empty($available_fields)) {
|
| 88 |
+
$available_fields = array_keys($product->getData());
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
$product_data = array("id" => $product_id);
|
| 92 |
+
foreach ($product_fields AS $product_field) {
|
| 93 |
+
if ($product->getExistsStoreValueFlag($product_field)) {
|
| 94 |
+
if ($collision == 'translated') {
|
| 95 |
+
// Skip value: assume it has been already translated
|
| 96 |
+
continue;
|
| 97 |
+
} else if ($collision == 'overwrite') {
|
| 98 |
+
// Delete: Overwrite store specific values with new translations
|
| 99 |
+
$master_product = $product_model->setStoreId($source_store_id)->load($product_id);
|
| 100 |
+
$product_data[$product_field] = $master_product->getData($product_field);
|
| 101 |
+
continue;
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
$product_data[$product_field] = $product->getData($product_field);
|
| 105 |
+
}
|
| 106 |
+
$products_out[] = $product_data;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
$response = array(
|
| 110 |
+
'product_details' => $products_out,
|
| 111 |
+
'available_fields' => $available_fields
|
| 112 |
+
);
|
| 113 |
+
} catch (Exception $e) {
|
| 114 |
+
$response = $e;
|
| 115 |
+
}
|
| 116 |
+
$this->serveRequest($response);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
public function getCategoriesAction() {
|
| 120 |
+
try {
|
| 121 |
+
$this->_validateToken();
|
| 122 |
+
|
| 123 |
+
$category_ids_str = $this->getRequest()->getParam('category_ids');
|
| 124 |
+
$category_ids = explode(",", $category_ids_str);
|
| 125 |
+
|
| 126 |
+
$categories_out = array();
|
| 127 |
+
$ExtractCategoryData = function($category_id, $parent_cat_id = null) use (&$ExtractCategoryData, &$categories_out) {
|
| 128 |
+
/** @var Mage_Catalog_Model_Category $cat */
|
| 129 |
+
$cat = Mage::getModel('catalog/category');
|
| 130 |
+
$cat->load($category_id);
|
| 131 |
+
|
| 132 |
+
$categories_out[$category_id] = array(
|
| 133 |
+
'name' => $cat->getName(),
|
| 134 |
+
'product_count' => $cat->getProductCount(),
|
| 135 |
+
);
|
| 136 |
+
if ($parent_cat_id) {
|
| 137 |
+
$categories_out[$category_id]['parent_id'] = $category_id;
|
| 138 |
+
}
|
| 139 |
+
$cat_children_ids = $cat->getAllChildren(true);
|
| 140 |
+
foreach ($cat_children_ids AS $cat_children_id) {
|
| 141 |
+
if ($cat_children_id == $category_id) {
|
| 142 |
+
continue;
|
| 143 |
+
}
|
| 144 |
+
$ExtractCategoryData($cat_children_id, $category_id);
|
| 145 |
+
}
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
foreach ($category_ids AS $category_id) {
|
| 149 |
+
$ExtractCategoryData($category_id);
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
$response = array(
|
| 153 |
+
'categories' => $categories_out
|
| 154 |
+
);
|
| 155 |
+
} catch (Exception $e) {
|
| 156 |
+
$response = $e;
|
| 157 |
+
}
|
| 158 |
+
$this->serveRequest($response);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
public function pingAction() {
|
| 162 |
+
$this->getResponse()
|
| 163 |
+
->setBody(
|
| 164 |
+
Mage::helper('core')->jsonEncode(array("time" => time())))
|
| 165 |
+
->setHttpResponseCode(200)
|
| 166 |
+
->setHeader('Content-type', 'application/json', true);
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
public function saveAction() {
|
| 170 |
try {
|
| 171 |
$this->_validateToken();
|
| 454 |
/** @var Mage_Catalog_Model_Product_Action $product_action */
|
| 455 |
$product_action->updateAttributes(
|
| 456 |
array($product_id),
|
| 457 |
+
array((string)$field_name => ($payload['text'] ? $payload['text'] : '')),
|
| 458 |
$store_id);
|
| 459 |
|
| 460 |
return $this->_updateOrder($store_id, $text_id, $payload['level']);
|
| 468 |
/** @var Transfluent_Translate_Model_Mysql4_Transfluenttranslate_Collection $order */
|
| 469 |
$order->setDataToAll('status', 2);
|
| 470 |
$order->save();
|
| 471 |
+
}/* else {
|
| 472 |
throw new Transfluent_Translate_Exception_EFailedToUpdateOrder();
|
| 473 |
+
}*/
|
| 474 |
return true;
|
| 475 |
}
|
| 476 |
}
|
app/code/community/Transfluent/Translate/etc/config.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Transfluent_Translate>
|
| 5 |
-
<version>1.
|
| 6 |
</Transfluent_Translate>
|
| 7 |
</modules>
|
| 8 |
|
|
@@ -143,8 +143,8 @@
|
|
| 143 |
<title>Translations</title>
|
| 144 |
<children>
|
| 145 |
<submenu translate="title" module="transfluenttranslate">
|
| 146 |
-
<title>Order translations by
|
| 147 |
-
<action>transfluenttranslate/adminhtml_transfluentorder/
|
| 148 |
</submenu>
|
| 149 |
</children>
|
| 150 |
<sort_order>71</sort_order>
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<Transfluent_Translate>
|
| 5 |
+
<version>1.3.0</version>
|
| 6 |
</Transfluent_Translate>
|
| 7 |
</modules>
|
| 8 |
|
| 143 |
<title>Translations</title>
|
| 144 |
<children>
|
| 145 |
<submenu translate="title" module="transfluenttranslate">
|
| 146 |
+
<title>Order translations by category</title>
|
| 147 |
+
<action>transfluenttranslate/adminhtml_transfluentorder/orderByCategoryStep1</action>
|
| 148 |
</submenu>
|
| 149 |
</children>
|
| 150 |
<sort_order>71</sort_order>
|
app/code/community/Transfluent/Translate/etc/system.xml
CHANGED
|
@@ -112,7 +112,7 @@
|
|
| 112 |
or visit <a href="https://www.transfluent.com/my-account/">your Transfluent account page</a> to setup a credit card.
|
| 113 |
</p>
|
| 114 |
<strong>Support:</strong> <a href="mailto:support@transfluent.com">support@transfluent.com</a><br>
|
| 115 |
-
<strong>Extension version:</strong> 1.
|
| 116 |
<strong>Extension homepage:</strong> <a href="http://www.transfluent.com/products/magento/">transfluent.com/products/magento</a>
|
| 117 |
]]></comment>
|
| 118 |
<fields>
|
| 112 |
or visit <a href="https://www.transfluent.com/my-account/">your Transfluent account page</a> to setup a credit card.
|
| 113 |
</p>
|
| 114 |
<strong>Support:</strong> <a href="mailto:support@transfluent.com">support@transfluent.com</a><br>
|
| 115 |
+
<strong>Extension version:</strong> 1.3.0<br>
|
| 116 |
<strong>Extension homepage:</strong> <a href="http://www.transfluent.com/products/magento/">transfluent.com/products/magento</a>
|
| 117 |
]]></comment>
|
| 118 |
<fields>
|
app/design/adminhtml/default/default/template/transfluent/order/{order.phtml → category_step1.phtml}
RENAMED
|
@@ -4,13 +4,138 @@ $languageHelper = Mage::helper('transfluenttranslate/languages');
|
|
| 4 |
|
| 5 |
/** @var Transfluent_Translate_Helper_Category $categoryHelper */
|
| 6 |
$categoryHelper = Mage::helper('transfluenttranslate/category');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
?>
|
| 8 |
|
| 9 |
<div class="content-header">
|
| 10 |
-
<h3 class="icon-head head-products"><?= $languageHelper->__('Order translations
|
| 11 |
</div>
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
$stores = Mage::app()->getStores();
|
| 15 |
if (!$stores || count($stores) < 2) {
|
| 16 |
?>
|
|
@@ -430,3 +555,4 @@ function updateQuoteForm(obj) {
|
|
| 430 |
}
|
| 431 |
}
|
| 432 |
</script>
|
|
|
| 4 |
|
| 5 |
/** @var Transfluent_Translate_Helper_Category $categoryHelper */
|
| 6 |
$categoryHelper = Mage::helper('transfluenttranslate/category');
|
| 7 |
+
|
| 8 |
+
$level = $this->getRequest()->getParam('level');
|
| 9 |
+
$source = $this->getRequest()->getParam('source');
|
| 10 |
+
$target = $this->getRequest()->getParam('target');
|
| 11 |
+
$collision_strategy = $this->getRequest()->getParam('collision');
|
| 12 |
?>
|
| 13 |
|
| 14 |
<div class="content-header">
|
| 15 |
+
<h3 class="icon-head head-products"><?= $languageHelper->__('Order translations by category') ?></h3>
|
| 16 |
</div>
|
| 17 |
|
| 18 |
+
<div style="padding: 1rem; color: #ccc; margin-top: -1rem;">
|
| 19 |
+
<strong style="color: black;">1. Choose source&target</strong> > 2. Choose categories > 3. Get quote > 4. Order!
|
| 20 |
+
</div>
|
| 21 |
+
|
| 22 |
+
<div class="entry-edit" style="width: 33%; min-width: 550px;">
|
| 23 |
+
<form action="<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep2')?>" method="post" id="edit_form"><div><input name="form_key" type="hidden" value="<?=Mage::getSingleton('core/session')->getFormKey()?>"></div><div class="entry-edit-head">
|
| 24 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Translation options</h4>
|
| 25 |
+
<div class="form-buttons"></div>
|
| 26 |
+
</div>
|
| 27 |
+
<div class="fieldset " id="base_fieldset">
|
| 28 |
+
<div class="hor-scroll">
|
| 29 |
+
<table cellspacing="0" class="form-list">
|
| 30 |
+
<tbody>
|
| 31 |
+
<tr>
|
| 32 |
+
<td class="label"><label for="username">Translator level</label></td>
|
| 33 |
+
<td class="value">
|
| 34 |
+
<select name="level">
|
| 35 |
+
<option value="native" <?=($level == 'native' ? 'selected="selected"' : '')?>>Native</option>
|
| 36 |
+
<option value="business" <?=(!$level || $level == 'business' ? 'selected="selected"' : '')?>>Business</option>
|
| 37 |
+
</select>
|
| 38 |
+
</td>
|
| 39 |
+
</tr>
|
| 40 |
+
<?php
|
| 41 |
+
$website_dropdown_options = '';
|
| 42 |
+
$websites = Mage::app()->getWebsites();
|
| 43 |
+
foreach ($websites AS $website) {
|
| 44 |
+
/** @var Mage_Core_Model_Website $website */
|
| 45 |
+
$website_dropdown_options .= '<optgroup label="' . htmlspecialchars($website->getName()) . '"></optgroup>';
|
| 46 |
+
$website_default_store = $website->getDefaultStore();
|
| 47 |
+
$website_default_store_id = $website_default_store->getId();
|
| 48 |
+
unset($website_default_store);
|
| 49 |
+
$stores = $website->getStores();
|
| 50 |
+
foreach ($stores AS $store) {
|
| 51 |
+
/** @var Mage_Core_Model_Store $store */
|
| 52 |
+
$store_locale_code = $languageHelper->GetStoreLocale($store->getCode());
|
| 53 |
+
$selected_source = (!$source && $store->getId() == $website_default_store_id || $source == $store->getId());
|
| 54 |
+
$selected_target = ($target && $store->getId() == $target);
|
| 55 |
+
$website_dropdown_options .= '<option value="' . $store->getId() . '" ' . ($selected_source ? 'SOURCE-SELECTED' : '') . ($selected_target ? 'TARGET-SELECTED' : '') . '> ' . htmlspecialchars($store->getName()) . ' (' . $languageHelper->getLanguageNameByCode($store_locale_code, true) . ', ' . $store_locale_code . ')</option>';
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
?>
|
| 59 |
+
<tr>
|
| 60 |
+
<td class="label"><label for="firstname">Translate from</label></td>
|
| 61 |
+
<td class="value">
|
| 62 |
+
<select name="source">
|
| 63 |
+
<?=str_replace(array('SOURCE-SELECTED', 'TARGET-SELECTED'), array('selected="selected"', ''), $website_dropdown_options)?>
|
| 64 |
+
</select>
|
| 65 |
+
</td>
|
| 66 |
+
</tr>
|
| 67 |
+
<tr>
|
| 68 |
+
<td class="label"><label for="firstname">Translate into</label></td>
|
| 69 |
+
<td class="value">
|
| 70 |
+
<select name="target">
|
| 71 |
+
<option></option>
|
| 72 |
+
<?=str_replace(array('TARGET-SELECTED', 'SOURCE-SELECTED'), array('selected="selected"', ''), $website_dropdown_options)?>
|
| 73 |
+
</select>
|
| 74 |
+
</td>
|
| 75 |
+
</tr>
|
| 76 |
+
<tr>
|
| 77 |
+
<td class="label"><label for="username">Existing content in target store view..</label></td>
|
| 78 |
+
<td class="value">
|
| 79 |
+
<select name="collision">
|
| 80 |
+
<option value="translated" <?=($collision_strategy == 'translated' ? 'selected="selected"' : '')?>>Skip: Assume any store specific value to be already translated</option>
|
| 81 |
+
<option value="source" <?=($collision_strategy == 'source' ? 'selected="selected"' : '')?>>Translate: Use any store specific value as source text for translation</option>
|
| 82 |
+
<option value="overwrite" <?=($collision_strategy == 'overwrite' ? 'selected="selected"' : '')?>>Delete: Overwrite store specific values with new translations</option>
|
| 83 |
+
</select>
|
| 84 |
+
</td>
|
| 85 |
+
</tr>
|
| 86 |
+
<tr>
|
| 87 |
+
<td class="label"></td>
|
| 88 |
+
<td class="value" style="text-align: right;">
|
| 89 |
+
<button title="Next" type="submit" class="scalable save">Next</button>
|
| 90 |
+
</td>
|
| 91 |
+
</tr>
|
| 92 |
+
</tbody>
|
| 93 |
+
</table>
|
| 94 |
+
<p>
|
| 95 |
+
<!-- <i class="link-store-scope"></i> TBD: Some kind of protip goes here! -->
|
| 96 |
+
</p>
|
| 97 |
+
</div>
|
| 98 |
+
</div>
|
| 99 |
+
</form></div>
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
|
| 109 |
<?php
|
| 110 |
+
print '<pre>';
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
//var_dump(Mage::app()->getWebsites());
|
| 116 |
+
die; // DEBUG
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
return;
|
| 137 |
+
|
| 138 |
+
|
| 139 |
$stores = Mage::app()->getStores();
|
| 140 |
if (!$stores || count($stores) < 2) {
|
| 141 |
?>
|
| 555 |
}
|
| 556 |
}
|
| 557 |
</script>
|
| 558 |
+
<?php print memory_get_peak_usage();
|
app/design/adminhtml/default/default/template/transfluent/order/category_step2.phtml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/** @var Transfluent_Translate_Helper_Languages $languageHelper */
|
| 3 |
+
$languageHelper = Mage::helper('transfluenttranslate/languages');
|
| 4 |
+
|
| 5 |
+
/** @var Transfluent_Translate_Helper_Category $categoryHelper */
|
| 6 |
+
$categoryHelper = Mage::helper('transfluenttranslate/category');
|
| 7 |
+
|
| 8 |
+
$target = $this->getRequest()->getParam('target');
|
| 9 |
+
$source = $this->getRequest()->getParam('source');
|
| 10 |
+
$level = $this->getRequest()->getParam('level');
|
| 11 |
+
$collision_strategy = $this->getRequest()->getParam('collision');
|
| 12 |
+
$categories = $this->getRequest()->getParam('chk_group');
|
| 13 |
+
|
| 14 |
+
$source_store = Mage::app()->getStore($source);
|
| 15 |
+
?>
|
| 16 |
+
|
| 17 |
+
<div class="content-header">
|
| 18 |
+
<h3 class="icon-head head-products"><?= $languageHelper->__('Order translations by category') ?></h3>
|
| 19 |
+
</div>
|
| 20 |
+
|
| 21 |
+
<div style="padding: 1rem; color: #ccc; margin-top: -1rem;">
|
| 22 |
+
<span style="color: #666;">1. Choose source&target</span> > <strong style="color: black;">2. Choose categories</strong> > 3. Get quote > 4. Order!
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<div class="entry-edit" style="width: 33%; min-width: 550px;">
|
| 26 |
+
<form action="<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep3')?>" method="post" id="edit_form"><div><input name="form_key" type="hidden" value="<?=Mage::getSingleton('core/session')->getFormKey()?>"></div><div class="entry-edit-head">
|
| 27 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Select categories to translate content from</h4>
|
| 28 |
+
<div class="form-buttons"></div>
|
| 29 |
+
</div>
|
| 30 |
+
<input type="hidden" name="source" value="<?=$source?>">
|
| 31 |
+
<input type="hidden" name="target" value="<?=$target?>">
|
| 32 |
+
<input type="hidden" name="level" value="<?=$level?>">
|
| 33 |
+
<input type="hidden" name="collision" value="<?=$collision_strategy?>">
|
| 34 |
+
<div class="fieldset " id="base_fieldset">
|
| 35 |
+
<div class="hor-scroll">
|
| 36 |
+
|
| 37 |
+
<div style="margin-left: 20px;">
|
| 38 |
+
<?php
|
| 39 |
+
print $categoryHelper->getCategoriesHTML(array($source_store->getRootCategoryId()), array_values($categories ? $categories : array()));
|
| 40 |
+
?>
|
| 41 |
+
</div>
|
| 42 |
+
<div style="text-align: right; margin-right: 33%;">
|
| 43 |
+
<button title="Back" type="button" class="scalable" onclick="$(this).up('form').writeAttribute('action', '<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep1')?>').submit(); return false;">Back</button>
|
| 44 |
+
<button title="Next" type="submit" class="scalable save">Next</button>
|
| 45 |
+
</div>
|
| 46 |
+
|
| 47 |
+
<p style="margin-top: 1.5rem;">
|
| 48 |
+
<i class="link-store-scope"></i> Please note: Selecting a higher level category will include all products from subcategories, regardless if subcategories have been checked or not
|
| 49 |
+
</p>
|
| 50 |
+
</div>
|
| 51 |
+
</div>
|
| 52 |
+
</form></div>
|
app/design/adminhtml/default/default/template/transfluent/order/category_step3.phtml
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/** @var Transfluent_Translate_Helper_Languages $languageHelper */
|
| 3 |
+
$languageHelper = Mage::helper('transfluenttranslate/languages');
|
| 4 |
+
|
| 5 |
+
/** @var Transfluent_Translate_Helper_Category $categoryHelper */
|
| 6 |
+
$categoryHelper = Mage::helper('transfluenttranslate/category');
|
| 7 |
+
|
| 8 |
+
$target = $this->getRequest()->getParam('target');
|
| 9 |
+
$source = $this->getRequest()->getParam('source');
|
| 10 |
+
$level = $this->getRequest()->getParam('level');
|
| 11 |
+
$collision_strategy = $this->getRequest()->getParam('collision');
|
| 12 |
+
$categories = $this->getRequest()->getParam('chk_group');
|
| 13 |
+
$instructions = $this->getRequest()->getParam('instructions') ? $this->getRequest()->getParam('instructions') : '';
|
| 14 |
+
|
| 15 |
+
$source_store = Mage::app()->getStore($source);
|
| 16 |
+
|
| 17 |
+
$quote_id = $this->getData('quote_id') ? $this->getData('quote_id') : $this->getRequest()->getParam('quote_id');
|
| 18 |
+
|
| 19 |
+
?>
|
| 20 |
+
|
| 21 |
+
<div class="content-header">
|
| 22 |
+
<h3 class="icon-head head-products"><?= $languageHelper->__('Order translations by category') ?></h3>
|
| 23 |
+
</div>
|
| 24 |
+
|
| 25 |
+
<div style="padding: 1rem; color: #ccc; margin-top: -1rem;">
|
| 26 |
+
<span style="color: #666;">1. Choose source&target</span> > <span style="color: #666;">2. Choose categories</span> > <strong style="color: black;">3. Get a quote</strong> > 4. Order!
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<div class="entry-edit" style="width: 33%; min-width: 550px;">
|
| 30 |
+
<form action="<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep3')?>" method="post" id="edit_form"><div><input name="form_key" type="hidden" value="<?=Mage::getSingleton('core/session')->getFormKey()?>"></div><div class="entry-edit-head">
|
| 31 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Get a quote</h4>
|
| 32 |
+
<div class="form-buttons"></div>
|
| 33 |
+
</div>
|
| 34 |
+
<div class="fieldset " id="base_fieldset">
|
| 35 |
+
<div class="hor-scroll">
|
| 36 |
+
<input type="hidden" name="source" id="source" value="<?=$source?>">
|
| 37 |
+
<input type="hidden" name="target" id="target" value="<?=$target?>">
|
| 38 |
+
<input type="hidden" name="level" id="level" value="<?=$level?>">
|
| 39 |
+
<input type="hidden" name="quote_id" id="quote_id" value="<?=$quote_id?>">
|
| 40 |
+
<input type="hidden" name="collision" id="collision" value="<?=$collision_strategy?>">
|
| 41 |
+
<?php
|
| 42 |
+
foreach ($categories AS $category_id) {
|
| 43 |
+
?><input type="hidden" name="chk_group[]" value="<?=$category_id?>"><?php
|
| 44 |
+
}
|
| 45 |
+
?>
|
| 46 |
+
|
| 47 |
+
<?php
|
| 48 |
+
// @todo: AUTOMATIC XHR STATUS POLL LOOP
|
| 49 |
+
// @todo: Show control to pick which fields to translate etc.
|
| 50 |
+
?>
|
| 51 |
+
|
| 52 |
+
<div id="quote_canvas" style="margin-bottom: 1rem;">
|
| 53 |
+
Loading..
|
| 54 |
+
</div>
|
| 55 |
+
|
| 56 |
+
<div id="quote_fields" style="margin-bottom: 1rem; display: none;">
|
| 57 |
+
<?php // @todo: Allow to change fields to translate ?>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<div id="quote_instructions" style="margin-top: 2rem; margin-bottom: 1rem; display: none;">
|
| 61 |
+
<label><strong>Instructions to translators (e.g. translation tone, target audience etc.)</strong><br>
|
| 62 |
+
<textarea name="instructions" rows="4" cols="75"><?=htmlspecialchars($instructions)?></textarea></label><br>
|
| 63 |
+
</div>
|
| 64 |
+
|
| 65 |
+
<div style="margin-right: 33%;">
|
| 66 |
+
<button title="Back" type="button" class="scalable" onclick="$(this).up('form').writeAttribute('action', '<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep2')?>').submit(); return false;">Back</button>
|
| 67 |
+
<button title="Refresh" id="quote_refresh_btn" type="submit" class="scalable save">Refresh</button>
|
| 68 |
+
<button title="Order" id="quote_order_btn" type="submit" class="scalable save" onclick="OrderClick(this); return false;" disabled="disabled">Order</button>
|
| 69 |
+
</div>
|
| 70 |
+
|
| 71 |
+
<p style="margin-top: 1.5rem;">
|
| 72 |
+
<i class="link-store-scope"></i> Please note that following product fields are translated: name, description and short description. Choosing the fields to be translated is possible in next release of this extension.
|
| 73 |
+
</p>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</form></div>
|
| 77 |
+
|
| 78 |
+
<script>
|
| 79 |
+
function OrderClick(element) {
|
| 80 |
+
if (!confirm('Are you sure?')) {
|
| 81 |
+
return;
|
| 82 |
+
}
|
| 83 |
+
//$(element).up('form').writeAttribute('action', '<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep4')?>').submit(); // @todo: Restore once translate_fields -selection is implemented
|
| 84 |
+
$(element).up('form').writeAttribute('action', '<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep5')?>').submit();
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
document.observe("dom:loaded", function() {
|
| 88 |
+
var instructions_box = $('quote_instructions');
|
| 89 |
+
var order_btn = $('quote_order_btn');
|
| 90 |
+
order_btn.hide();
|
| 91 |
+
var refresh_btn = $('quote_refresh_btn');
|
| 92 |
+
refresh_btn.hide();
|
| 93 |
+
var PollerFunction = function() {
|
| 94 |
+
new Ajax.Request('<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep3')?>', {
|
| 95 |
+
parameters: {quote_id: $F('quote_id')},
|
| 96 |
+
onSuccess: function (xhr) {
|
| 97 |
+
var response = xhr.responseJSON;
|
| 98 |
+
$('quote_canvas').update(response.status);
|
| 99 |
+
switch (response.status_code) {
|
| 100 |
+
case "0":
|
| 101 |
+
case "1":
|
| 102 |
+
refresh_btn.show();
|
| 103 |
+
setTimeout(PollerFunction, 2500);
|
| 104 |
+
break;
|
| 105 |
+
case "2":
|
| 106 |
+
order_btn.show().removeAttribute('disabled');
|
| 107 |
+
refresh_btn.hide();
|
| 108 |
+
instructions_box.show();
|
| 109 |
+
// response.translate_fields_available vs. translate_fields
|
| 110 |
+
break;
|
| 111 |
+
case "3":
|
| 112 |
+
order_btn.hide();
|
| 113 |
+
instructions_box.hide();
|
| 114 |
+
break;
|
| 115 |
+
default:
|
| 116 |
+
order_btn.hide();
|
| 117 |
+
refresh_btn.show();
|
| 118 |
+
instructions_box.hide();
|
| 119 |
+
break;
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
});
|
| 123 |
+
};
|
| 124 |
+
PollerFunction();
|
| 125 |
+
|
| 126 |
+
});
|
| 127 |
+
</script>
|
| 128 |
+
|
app/design/adminhtml/default/default/template/transfluent/order/category_step4.phtml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/** @var Transfluent_Translate_Helper_Languages $languageHelper */
|
| 3 |
+
$languageHelper = Mage::helper('transfluenttranslate/languages');
|
| 4 |
+
|
| 5 |
+
/** @var Transfluent_Translate_Helper_Category $categoryHelper */
|
| 6 |
+
$categoryHelper = Mage::helper('transfluenttranslate/category');
|
| 7 |
+
|
| 8 |
+
$target = $this->getRequest()->getParam('target');
|
| 9 |
+
$source = $this->getRequest()->getParam('source');
|
| 10 |
+
$level = $this->getRequest()->getParam('level');
|
| 11 |
+
$collision_strategy = $this->getRequest()->getParam('collision');
|
| 12 |
+
$categories = $this->getRequest()->getParam('chk_group');
|
| 13 |
+
|
| 14 |
+
$source_store = Mage::app()->getStore($source);
|
| 15 |
+
//$target_store = Mage::app()->getStore($target);
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
//$category = Mage::getModel('catalog/category')->load($source_store->getRootCategoryId());
|
| 19 |
+
//var_dump($category->debug());
|
| 20 |
+
|
| 21 |
+
$quote_id = $this->getData('quote_id');
|
| 22 |
+
|
| 23 |
+
?>
|
| 24 |
+
|
| 25 |
+
<div class="content-header">
|
| 26 |
+
<h3 class="icon-head head-products"><?= $languageHelper->__('Order translations by category') ?></h3>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<div style="padding: 1rem; color: #ccc; margin-top: -1rem;">
|
| 30 |
+
<span style="color: #666;">1. Choose source&target</span> > <span style="color: #666;">2. Choose categories</span> > <span style="color: #666;">3. Get a quote</span> > <strong style="color: black;">4. Order!</strong>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
<div class="entry-edit" style="width: 33%; min-width: 550px;">
|
| 34 |
+
<form action="<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep5')?>" method="post" id="edit_form"><div><input name="form_key" type="hidden" value="<?=Mage::getSingleton('core/session')->getFormKey()?>"></div><div class="entry-edit-head">
|
| 35 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Order</h4>
|
| 36 |
+
<div class="form-buttons"></div>
|
| 37 |
+
</div>
|
| 38 |
+
<div class="fieldset " id="base_fieldset">
|
| 39 |
+
<div class="hor-scroll">
|
| 40 |
+
<input type="hidden" name="source" value="<?=$source?>">
|
| 41 |
+
<input type="hidden" name="target" value="<?=$target?>">
|
| 42 |
+
<input type="hidden" name="level" value="<?=$level?>">
|
| 43 |
+
<input type="hidden" name="quote_id" value="<?=$quote_id?>">
|
| 44 |
+
<input type="hidden" name="collision" value="<?=$collision_strategy?>">
|
| 45 |
+
<?php
|
| 46 |
+
foreach ($categories AS $category_id) {
|
| 47 |
+
?><input type="hidden" name="chk_group[]" value="<?=$category_id?>"><?php
|
| 48 |
+
}
|
| 49 |
+
?>
|
| 50 |
+
|
| 51 |
+
TBD: Confirm order + place actual order req.!
|
| 52 |
+
|
| 53 |
+
<div style="margin-right: 33%;">
|
| 54 |
+
<button title="Back" type="button" class="scalable" onclick="$(this).up('form').writeAttribute('action', '<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep3')?>').submit(); return false;">Back</button>
|
| 55 |
+
<button title="Order" type="submit" class="scalable save">Order</button>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
</form></div>
|
app/design/adminhtml/default/default/template/transfluent/order/category_step5.phtml
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/** @var Transfluent_Translate_Helper_Languages $languageHelper */
|
| 3 |
+
$languageHelper = Mage::helper('transfluenttranslate/languages');
|
| 4 |
+
|
| 5 |
+
$fork_id = $this->getData('fork_id');
|
| 6 |
+
$quote_id = $this->getData('quote_id');
|
| 7 |
+
?>
|
| 8 |
+
|
| 9 |
+
<div class="content-header">
|
| 10 |
+
<h3 class="icon-head head-products"><?= $languageHelper->__('Order translations by category') ?></h3>
|
| 11 |
+
</div>
|
| 12 |
+
|
| 13 |
+
<div style="padding: 1rem; color: #ccc; margin-top: -1rem;">
|
| 14 |
+
<span style="color: #666;">1. Choose source&target</span> > <span style="color: #666;">2. Choose categories</span> > <span style="color: #666;">3. Get a quote</span> > <strong style="color: black;">4. Order!</strong>
|
| 15 |
+
</div>
|
| 16 |
+
|
| 17 |
+
<div class="entry-edit" style="width: 33%; min-width: 550px;">
|
| 18 |
+
<div class="entry-edit-head">
|
| 19 |
+
<h4 class="icon-head head-edit-form fieldset-legend">Order</h4>
|
| 20 |
+
<div class="form-buttons"></div>
|
| 21 |
+
</div>
|
| 22 |
+
<div class="fieldset " id="base_fieldset">
|
| 23 |
+
<input type="hidden" name="quote_id" id="quote_id" value="<?=$quote_id?>">
|
| 24 |
+
<div id="quote_canvas" style="margin-bottom: 1rem;">
|
| 25 |
+
Loading..
|
| 26 |
+
</div>
|
| 27 |
+
<div class="hor-scroll" id="thanks" style="display: none;">
|
| 28 |
+
<h2>Thank you!</h2>
|
| 29 |
+
<p>Your order has been successfully placed. The ordered items and their progress are shown in <!-- "<a href="<?=$this->getUrl('transfluent/adminhtml_transfluenttranslate/index')?>">Translations</a>" section in Magento and under--> "<a href="https://www.transfluent.com/my-account/" target="_blank">My Account</a>" on our website.</p>
|
| 30 |
+
</div>
|
| 31 |
+
</div>
|
| 32 |
+
</div>
|
| 33 |
+
<script>
|
| 34 |
+
var PollFunction = function() {
|
| 35 |
+
new Ajax.Request('<?=$this->getUrl('transfluent/adminhtml_transfluentorder/orderByCategoryStep3')?>', {
|
| 36 |
+
parameters: {quote_id: $F('quote_id')},
|
| 37 |
+
onSuccess: function (xhr) {
|
| 38 |
+
var response = xhr.responseJSON;
|
| 39 |
+
$('quote_canvas').update(response.status);
|
| 40 |
+
switch (response.status_code) {
|
| 41 |
+
case "4":
|
| 42 |
+
setTimeout(PollFunction, 2500);
|
| 43 |
+
break;
|
| 44 |
+
case "3":
|
| 45 |
+
$('thanks').show();
|
| 46 |
+
$('quote_canvas').hide();
|
| 47 |
+
break;
|
| 48 |
+
default:
|
| 49 |
+
alert('Something unexpected happened while processing the order. Please contact support@transfluent.com to resolve the situation.');
|
| 50 |
+
break;
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
});
|
| 54 |
+
};
|
| 55 |
+
document.observe("dom:loaded", PollFunction);
|
| 56 |
+
</script>
|
| 57 |
+
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Transfluent</name>
|
| 4 |
-
<version>1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>MIT</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -18,11 +18,11 @@
|
|
| 18 |
<description><p>The Transfluent plugin automates the process of translating product and category information using human translators. Magento admins need only to select what to translate and click order.</p>
|
| 19 |

|
| 20 |
<p>Translating content is handled in our backend using a vast network of professional translators.</p></description>
|
| 21 |
-
<notes>
|
| 22 |
-
<authors><author><name>Transfluent
|
| 23 |
-
<date>2015-07-
|
| 24 |
-
<time>
|
| 25 |
-
<contents><target name="magecommunity"><dir name="Transfluent"><dir name="Translate"><dir name="Block"><file name="Account.php" hash="65a7a12e2ad88a5c4ba14b6c7c72fd03"/><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="d2827c5587a2bb7c8664ff92c3dcf5d7"/><dir name="Renderer"><file name="Language.php" hash="cfc3a15752ecc6f7aab870ea6834c1df"/><file name="LanguagePair.php" hash="8d1c1959b44b487570d135eb5758a63b"/><file name="Level.php" hash="4a8f278da146ce9c8108758924bea667"/><file name="SourceText.php" hash="23c33835a99e64d575b101491774ed89"/><file name="Store.php" hash="4639d9f82bb498e57842a83110573e0c"/></dir></dir></dir><dir name="Tag"><dir name="Tag"><file name="Grid.php" hash="24647d2a73089769f664f7ae8f686597"/></dir></dir><dir name="Transfluentorder"><dir name="Edit"><file name="Form.php" hash="17fc3866562d4820c251ed17cc154b4d"/><dir name="Tab"><file name="Form.php" hash="3d45b7754d0044de84f6d40cb4cca9bf"/></dir><file name="Tabs.php" hash="5654a57d38cb31fb7159ffea72380adb"/></dir><file name="Edit.php" hash="e4a7206b94ec73e6573e62d22efc61ba"/></dir><file name="Transfluentorder.php" hash="
|
| 26 |
<compatible/>
|
| 27 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>Core</name><min></min><max></max></extension><extension><name>curl</name><min></min><max></max></extension><extension><name>json</name><min></min><max></max></extension></required></dependencies>
|
| 28 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Transfluent</name>
|
| 4 |
+
<version>1.3.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>MIT</license>
|
| 7 |
<channel>community</channel>
|
| 18 |
<description><p>The Transfluent plugin automates the process of translating product and category information using human translators. Magento admins need only to select what to translate and click order.</p>
|
| 19 |

|
| 20 |
<p>Translating content is handled in our backend using a vast network of professional translators.</p></description>
|
| 21 |
+
<notes>All new "Order translations by category" feature</notes>
|
| 22 |
+
<authors><author><name>Transfluent Ltd</name><user>Transfluent</user><email>coders@transfluent.com</email></author></authors>
|
| 23 |
+
<date>2015-07-23</date>
|
| 24 |
+
<time>07:53:36</time>
|
| 25 |
+
<contents><target name="magecommunity"><dir name="Transfluent"><dir name="Translate"><dir name="Block"><file name="Account.php" hash="65a7a12e2ad88a5c4ba14b6c7c72fd03"/><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="d2827c5587a2bb7c8664ff92c3dcf5d7"/><dir name="Renderer"><file name="Language.php" hash="cfc3a15752ecc6f7aab870ea6834c1df"/><file name="LanguagePair.php" hash="8d1c1959b44b487570d135eb5758a63b"/><file name="Level.php" hash="4a8f278da146ce9c8108758924bea667"/><file name="SourceText.php" hash="23c33835a99e64d575b101491774ed89"/><file name="Store.php" hash="4639d9f82bb498e57842a83110573e0c"/></dir></dir></dir><dir name="Tag"><dir name="Tag"><file name="Grid.php" hash="24647d2a73089769f664f7ae8f686597"/></dir></dir><dir name="Transfluentorder"><dir name="Edit"><file name="Form.php" hash="17fc3866562d4820c251ed17cc154b4d"/><dir name="Tab"><file name="Form.php" hash="3d45b7754d0044de84f6d40cb4cca9bf"/></dir><file name="Tabs.php" hash="5654a57d38cb31fb7159ffea72380adb"/></dir><file name="Edit.php" hash="e4a7206b94ec73e6573e62d22efc61ba"/></dir><file name="Transfluentorder.php" hash="eb38c2db57bb8b66edb169d38eb55a47"/><dir name="Transfluenttranslate"><dir name="Edit"><file name="Form.php" hash="9e9d2152d4dd8fe936558a88afd1c554"/><dir name="Tab"><file name="Form.php" hash="d6bb7a75b800f0dfb9a85d6b8547d3d2"/></dir><file name="Tabs.php" hash="1e4e31e2e4be31918e4db4d677092759"/></dir><file name="Edit.php" hash="596dc94ba740e312ad1ea8a3a86bdc43"/><file name="Grid.php" hash="275f7dd4f8abb376a51bab8ee815f8f9"/></dir><file name="Transfluenttranslate.php" hash="c9a69e2dc7bb9ded6a61db0988b4842f"/></dir><file name="Estimate.php" hash="bc70c44df7c0522dc56d2039ce73dc64"/><file name="Help.php" hash="1c6779b04425381242c053baf54cac1f"/><file name="Loginform.php" hash="af3b1a47ef8c35341e439b66bce88293"/><file name="Regform.php" hash="15cf4754d6c565618566edbaee80019b"/><file name="Translblock.php" hash="8008b680d4bdbeb7b2e51a3522ac282a"/></dir><dir name="Exception"><file name="Base.php" hash="e0ab547033d95d94820a5cbd58dea6f5"/><file name="EBackendCustomerHasNoBillingAgreement.php" hash="87f798c9e376b2392f33005181028e6b"/><file name="EFailedToUpdateOrder.php" hash="4261e774331f5e68864409c687e87e84"/><file name="EInvalidInput.php" hash="9e68fc972d84da619bc0f59a0309c673"/><file name="EInvalidJob.php" hash="be82fd6fe0c1dbc88be57fa4fd923196"/><file name="EInvalidTagFormat.php" hash="c8ac44aaec31e4ab77655ab85434724b"/><file name="ELanguagePairNotSupported.php" hash="696af3edef69e5ef009bbbd766db97ae"/><file name="ETagNotFound.php" hash="6bc8d1f2a8a5cbdfa9e83be92532e159"/><file name="ETransfluentAuthenticationExpired.php" hash="31d78696b92490440689d517ce3961ad"/><file name="ETransfluentAuthenticationExpiredBase.php" hash="5f31f311c1242c956dbe03ed56b89e8e"/><file name="ETransfluentInvalidInputTags.php" hash="d7e056e164a93a6fd9f9cffbc31664f8"/><file name="ETransfluentNothingToTranslate.php" hash="6b9aef0ccc8848dbbe33e4d55742a789"/><file name="ETransfluentOrderFail.php" hash="019f6eea7ea672217a6297ad1028ed02"/><file name="ETransfluentProductHasNoFieldsToTranslate.php" hash="324c6a7f92a4b2367ad9253aae319aa2"/><file name="ETransfluentProductNotFound.php" hash="d1ae6d72c99ba0061c3972e56f7508c1"/><file name="ETransfluentSomeSelectedProductsNotFound.php" hash="aaa71cede2f1136e8f6700f35bb3c541"/><file name="ETransfluentTagsNothingToTranslate.php" hash="aaec4494fcfa5f5801cc41d2488063b2"/><file name="ETransfluentUnknownBackendResponse.php" hash="8b88d91c6069383091b46416236fb516"/><file name="ETransfluentUnknownError.php" hash="f27e0198db51ae862cc69d969238acff"/><file name="ETransfluentUnknownErrorNoEstimate.php" hash="714d3ad48595f0a7f271ff4d6e41d5b7"/><file name="ETransfluentUnknownErrorTags.php" hash="6b56cfb2b97bed42edaff02e409ded3e"/><file name="EUnauthorized.php" hash="eb1ca081eebdc497cde30cd85337bc6e"/></dir><dir name="Helper"><file name="Category.php" hash="cfd0a78eb787b2c63e5d3323c41e0559"/><file name="Constant.php" hash="76af7760107c984a86a8522d08f33529"/><file name="Data.php" hash="115f604df2570d512d73c45eb272588b"/><file name="Languages.php" hash="7f14a01e59b803135e037c9be733e190"/><file name="Product.php" hash="ee04f0c62cdeef260c677cd1fc363041"/><file name="Tag.php" hash="aba096e9a6207e7f2055db4733c1b839"/><file name="Text.php" hash="4e5c084ac4e849d6fe2614dfef77c932"/><file name="Util.php" hash="2db7fdba0b945821e12746c45fb6bf9b"/></dir><dir name="Model"><file name="AttributeName.php" hash="97619966fb9c04b031d2cae5147fdb21"/><file name="AttributeOption.php" hash="39007a2e2821e5853b6cfefe0e1a1c17"/><dir name="Base"><file name="Backendclient.php" hash="1419100c6e5855c1fcdb2dbfa3195267"/></dir><file name="CategoryDetail.php" hash="3a0ce226c17ef8280ca9001c77e0d275"/><dir name="Config"><dir name="Source"><file name="Fromlang.php" hash="600bdc90cb5a08d36003ea651ee398c2"/><file name="Language.php" hash="dcbd7cc51695c71fa0da6da25e0d52d8"/><file name="Quality.php" hash="73987e05216bb54d3b483d751888e602"/></dir></dir><file name="Debugutil.php" hash="3542cff301f9fc0d69072068c384acb3"/><dir name="Mysql4"><dir name="Transfluenttranslate"><file name="Collection.php" hash="80ebe484ed7a4dee8980b4d6c03d1425"/></dir><file name="Transfluenttranslate.php" hash="bef2f82a3c2d2fd25031c654026bdc34"/></dir><file name="Observer.php" hash="96ca21eaefbf03ea6a84cfa1179d4c93"/><file name="ProductDetail.php" hash="5b9a5ce790576fe19e33fbbc63554a24"/><file name="TagName.php" hash="8d59f540cc0f1290b419f95f7dabe7c6"/><file name="Transfluentorder.php" hash="9dd3a64c16d95f7df151be2937a6d09c"/><file name="Transfluenttranslate.php" hash="d973756d579d415cd11033acb7669555"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AccountController.php" hash="3a259d4e68c2d8ca7ca0cccf9db2a792"/><file name="TransfluentorderController.php" hash="ebc755839ab05eb0b8aa2677cd36901d"/><file name="TransfluenttranslateController.php" hash="eca8e84b5e4f0a1ef0125894204303c6"/></dir><file name="TranslationController.php" hash="3ddc5f4c60d5b23c3a62027ad5db33f4"/></dir><dir name="etc"><file name="config.xml" hash="5befd6eac32766c492948cf2cbe614ac"/><file name="system.xml" hash="738bbc1fc156ca7296884fecdac5ede7"/></dir><dir name="sql"><dir name="transfluenttranslate_setup"><file name="mysql4-install-1.1.0.php" hash="1691b91c29d66284b51583bf47e5c9ec"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="transfluent.xml" hash="92accb97ee4a7c710ef46e01d1307f83"/></dir><dir name="template"><dir name="transfluent"><dir name="account"><file name="action.phtml" hash="dae17137e83be4001f25997892e49901"/><file name="create.phtml" hash="5b51d4a6f3f444494fe3b053c6f96463"/><file name="logged.phtml" hash="6f024c314550b3f378e5d8399984b082"/><file name="login.phtml" hash="06acb7c890315c53937a1dd5f90275a6"/></dir><file name="estimate.phtml" hash="f2b85bb6943c7ff335d45e2401e0b541"/><file name="estimate_section.phtml" hash="1d5a6c511ae63f85f490b52be4be5dc1"/><dir name="order"><file name="category_step1.phtml" hash="9d529128723ac3ec23dff9e75e73cc41"/><file name="category_step2.phtml" hash="29ca6c6c3a782b673c7e8fa40f4dc497"/><file name="category_step3.phtml" hash="07250961949fca41894ba727ffb0cbef"/><file name="category_step4.phtml" hash="839118d618937f04e2226521f274af18"/><file name="category_step5.phtml" hash="44883dd35c420513f052852faa96bd96"/></dir><dir name="product"><dir name="attributes"><file name="edit.phtml" hash="5c2e06cb7b18b6cb34dd09398e0690cb"/></dir><dir name="category"><file name="edit.phtml" hash="acb8acba1981d3f764d120a62a4a70a7"/></dir><file name="edit.phtml" hash="fb6e94f86ba351d045d8516cc244577e"/><file name="index.phtml" hash="7ea9b53f06a8045e19d4727c41059d58"/></dir><dir name="tag"><dir name="tag"><file name="index.phtml" hash="d672d3415faa28fc85406e537b689b3c"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Transfluent_Translate.xml" hash="21fbc30a1cba6c2b86b262439eee8ed3"/></dir></target><target name="mageweb"><dir name="js"><dir name="transfluent"><file name="actions.js" hash="471135bf9f5941d0e22d11aa726bfc3b"/><file name="lib.js" hash="0f1029e5a4a1c1e88ca2bb8304bc34e8"/></dir></dir></target></contents>
|
| 26 |
<compatible/>
|
| 27 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>Core</name><min></min><max></max></extension><extension><name>curl</name><min></min><max></max></extension><extension><name>json</name><min></min><max></max></extension></required></dependencies>
|
| 28 |
</package>
|
