TheGGTheory Posted May 13, 2016 Share Posted May 13, 2016 Hi all, I'm in neeed of some help witha module translation. I've developed my own module to make automatic shipping for a carrier i'm working for. I've add a new tab, children of the order tab ( my tab is a copy of the orders tab with some additions ).So i've ovveride AdminOrdersController class AdminOrdersClickAndQuickController extends AdminOrdersController { //stuff } and overrided multiple tpls( admin/ _myDocuments.tpl, _myShipping.tpl, _print_pdf_icons.tpl, list_footer.tpl, view.tpl [ for ovverriding i mean that i save my version of this files in override/controllers/admin/templates/my_module ecc on module install]). Everything works fine expect the translation. I've used the translation tools and saved all the translations and Now when i export the language traslation under the path it/themes/default-bootstrap/module/clickandquick i find the correct it.php. But when i go in my custom tab->orderDetail nothing is translated... Here my hookDisplayAdminOrder public function hookDisplayAdminOrder($params) { $id_order = (int)$params['id_order']; //-------Controllo se l'ordine e' gia' stato associato ad una spedizione click&Quick $sql = " SELECT `ID` FROM `" . _DB_PREFIX_ . "clickAndQuickOrder` WHERE `id_prestashopOrder` = " . $id_order . " "; $result = Db::getInstance()->executeS($sql); if (!empty($result)) { $clickAndQuickOrder = new ClickAndQuickOrder(); $clickAndQuickOrder->loadByID($result[0]['ID']); $totalClickAndQuickWeight = $clickAndQuickOrder->getPesoSpedizione(); } $customer = $this->context->customer; $cart = $params['cart']; $totalWeight = $cart->getTotalWeight(); $order = new Order($id_order); $order_details = OrderDetail::getList($id_order); $products = array(); $product = array(); $pickupAddress = new ClickAndQuickAddress(); $pickupAddress->loadByID(Configuration::get('IDIndirizzoDefault')); $psDeliveryAddress = new AddressCore($order->id_address_delivery); $cqDeliveryAddress = new ClickAndQuickAddress(); $cqDeliveryAddress->fromPsAddressToCqAddress($psDeliveryAddress); //se ho un mittente di default uso quello, altrimenti setto uguale a indirizzo di ritiro $IDDefaultSenderAddress = ConfigurationCore::get('IDIndirizzoDefaultMittente'); $cqSenderAddress = new ClickAndQuickAddress(); if ($IDDefaultSenderAddress != 0) { $cqSenderAddress->loadByID($IDDefaultSenderAddress); } else { $cqSenderAddress->loadByID(ConfigurationCore::get('IDIndirizzoDefault')); } $sql = " SELECT `denominazioneIta`,`ISO3166a3` FROM `" . _DB_PREFIX_ . "clickAndQuickNation` "; $allNation = Db::getInstance()->executeS($sql); $sql = " SELECT `denominazione`,`sigla` FROM `" . _DB_PREFIX_ . "clickAndQuickProvince` "; $allProvince = Db::getInstance()->executeS($sql); foreach ($order_details as $item) { $product['product_reference'] = $item['product_reference']; $product['product_name'] = $item['product_name']; $product['product_quantity'] = $item['product_quantity']; array_push($products, $product); } /* $sql = " SELECT `name` FROM `"._DB_PREFIX_."carrier` WHERE `id_carrier` = ".$order->id_carrier." "; $isCarrier = Db::getInstance()->getRow($sql); if(empty($isCarrier)) throw new PrestaShopException("Il corriere selezionato per questo ordine è stato eliminato");*/ //$todayDate viene usato per prepopolare la data di ritiro $todayDate = date("d/m/Y"); $modalitaUtilizzo = ConfigurationCore::get('modalitaUtilizzo'); $carrier = new Carrier($order->id_carrier); $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'pickupAddress' => $pickupAddress, 'deliveryAddress' => $cqDeliveryAddress, 'senderAddress' => $cqSenderAddress, 'allNation' => $allNation, 'allProvince' => $allProvince, 'totalWeight' => $totalWeight, 'cart' => $cart, 'products' => $products, 'order' => $order, 'isSentWithoutError' => 0, 'carrier' => $carrier, 'customer' => $customer, 'todayDate' => $todayDate, 'modalitaUtilizzo' => $modalitaUtilizzo, 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display') ) ); if (isset($clickAndQuickOrder)) { $parcelList = $clickAndQuickOrder->getParcelList(); $isSentWithoutError = $clickAndQuickOrder->isSentWithoutError(); $this->context->smarty->assign( array( 'clickAndQuickOrder' => $clickAndQuickOrder, 'totalClickAndQuickWeight' => $totalClickAndQuickWeight, 'isSentWithoutError' => $isSentWithoutError, 'parcelList' => $parcelList ) ); } return $this->display(__FILE__, 'parcel.tpl'); } Do i need to install the it.php file somewhere to make it work? In wich path of my module (mymodule/it.php or /mymodule/translation/it.php ) should i put the it.php file?Does the translation automatically install on module install?Thanks for you're help, have a good dayPS: sorry for typos and all the errors Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now