Jump to content

EmmanuelTesson

Members
  • Posts

    32
  • Joined

  • Last visited

Profile Information

  • Activity
    Developer

EmmanuelTesson's Achievements

Newbie

Newbie (1/14)

0

Reputation

1

Community Answers

  1. Bonjour est ce que quelqu'un aurait une info sur la roadmap 1.5? merci
  2. Bonjour je me réponds à moi même puisque j'ai testé une autre solution, mais avec d'autres problèmes ! j'ai tenté d'utiliser le hook OrderConfirmation. public function hookOrderConfirmation($params) { // var_dump($params);exit(); $objOrder = $params['objOrder']; $history = new OrderHistory(); $history->id_order = (int)$objOrder->id; $history->changeIdOrderState((int)(Configuration::get('PS_OS_APPROVALORDER')), (int)($objOrder->id)); } Le changement de statut est bien effectué en fin de commande et apparait bien dans la liste des commandes avec le bon statut (En attente de validation). Cependant, si je clique dans le détail de la commande, le statut est affiché comme "Préparation en cours", comme dans l'historique des commandes du client ??? cela devient un vrai mystère !
  3. Bonjour, J'essaie depuis quelques temps de mettre en oeuvre une approbation des commandes pour les clients faisant partie d'un groupe particulier. J'ai créé un module qui : ajoute un nouveau staut de commande "En attente d'approbation" teste l'utilisateur courant (appartenance à un groupe) J'ai essayé de greffer mon module aux hooks suivants sans succès : hookActionValidateOrder hookActionOrderStatusUpdate hookActionObjectOrderHistoryAddAfter J'obtiens à chaque fois une boucle sans fin, puisque je mets à jour le statut, qui lui-même se met à jour ensuite. Je tente donc d'utiliser le hook "hookActionOrderStatusPostUpdate", mais lorsque je mets à jour le statut, il se place avant le staut par défaut "Préparation en cours". le code du hook : public function hookActionOrderStatusPostUpdate($params) { // var_dump($params);exit(); $newOrderStatus = $params['newOrderStatus']; $id_order = $params['id_order']; $cart = $params['cart']; $order = new Order($id_order); $groups = Customer::getGroupsStatic($cart->id_customer); $approverGroups = Configuration::get(Tools::strtoupper($this->name).'_approvergroup'); $orderHistory = new OrderHistory(); $orderHistory->id_order = $id_order; // var_dump($order); /* echo 'currentState: '.$order->getCurrentState().' Approval status '.Configuration::get('PS_OS_APPROVALORDER'); exit(); */ if(!in_array($approverGroups,$groups) && $order->getCurrentState()== Configuration::get('PS_OS_PREPARATION')){ //Si non, la commande passe en statut "attente d'approbation" + "mail Approbateur" + mail commandeur $orderHistory->changeIdOrderState(Configuration::get('PS_OS_APPROVALORDER'), (int) $id_order); $orderHistory->add(); } } Je ne vois plus comment faire maintenant ? EDIT: bon je constate que si j'utilise le hook actionOrderStatusPostUpdate (ou les autres), je fais une boucle en appelant la fonction changeIdOrderState de la classe Orderhistory. je souhaite donc modifier directement la valeur de $new_os dans le cas où l'utilisateur n'a pas les droits d'approbation, en utilisant le hook actionOrderStatusUpdate. l'idée est de changer le statut par défaut par le statut custom "En attente d'approbation". est ce que l'on peut m'aider sur ce point ?
  4. hi bellini13 I added a custom order state in my module (Approval State). The "New State" i'm talking about, is the standard state of a new order. I will try quickly the hook you specified and i will tell you if it's ok for me.
  5. Hi thanks for all your quick answers! I would like to change the order status of a new order (Status "New") to an approval status, when there is one or more approval products in this order. This approval status is a custom new parameter i added to each product. I don't know if i'm clear enough?
  6. Yes ! i begun with the hookActionOrderStatusPostUpdate. But with this hook, the status change AFTER i made the first changeIdOrderState. the final status is not as expect. public function hookActionOrderStatusPostUpdate($params) { // Getting differents vars $context = Context::getContext(); $id_lang = (int)$context->language->id; $id_shop = (int)$context->shop->id; $checkApprovalProducts = array(); if($params['newOrderStatus']->id == Configuration::get('PS_OS_PREPARATION')){ $orderId = $params['id_order']; //Ok Id de la commande démarrée $order = new Order($orderId); $products = $order->getProducts(); // var_dump($products); foreach ($products as $key => $product) { //test: y a til un produit à valider ? $checkApproval = OrdersApprovalTable::loadByIdProduct($product['product_id']); if(isset($checkApproval->isApprovable) && $checkApproval->isApprovable >0) $checkApprovalProducts[] = $product['product_id']; } // var_dump($checkApprovalProducts);exit; if(count($checkApprovalProducts)>0){ $history = new OrderHistory(); $history->id_order = (int) $orderId; $history->changeIdOrderState(Configuration::get('PS_OS_APPROVALORDER'), (int) $orderId); $history->add(); } }
  7. Hi i'm trying to use the script with the dynamic hook, but there is no action after a modification of order's history. i registered the hook : if (!parent::install()OR !$this->registerHook('displayAdminProductsExtra') OR !$this->registerHook('actionProductUpdate') OR !$this->registerHook('actionOrderStatusPostUpdate') OR !$this->registerHook('actionObjectOrderHistoryAddAfter') OR !$this->runSql($sql)) return false; return true; And i wrote the same script : public function hookActionObjectOrderHistoryAddAfter($params) { // var_dump($params); $checkApprovalProducts = array(); $orderHistory = $params['object']; $order = new Order($orderHistory->id_order); $products = $order->getProducts(); // var_dump($products);exit; foreach ($products as $key => $product) { //test: y a til un produit à valider ? $checkApproval = OrdersApprovalTable::loadByIdProduct($product['product_id']); if(isset($checkApproval->isApprovable) && $checkApproval->isApprovable >0) $checkApprovalProducts[] = $product['product_id']; } if ($order->getCurrentState()==Configuration::get('PS_OS_PREPARATION') && count($checkApprovalProducts)>0) { $orderHistory->changeIdOrderState(Configuration::get('PS_OS_APPROVALORDER'), $order); $orderHistory->add(); } } } But after many orders, i did not see any action?
  8. Bonjour je souhaiterais savoir s'il y a toujours des mises à jour correctives et bug fixes sur la version 1.5 de PS. Si c'est le cas, à quel moment n'y aura t il plus de support de la version 1.5 ? Cdt
  9. +1 j'ai le même problème.. voir le topic actif... enfin je crois : https://www.prestashop.com/forums/topic/323813-le-champ-link-rewrite-est/
  10. Bonjour personnellement j'ai fait une mise à jour classique vers le 1.6.0.11, et cela a réactiver le template par défaut. j'ai suivi la procédure fournie sur : http://studio-aquilon.fr/blog/prestashop/comment-installer-theme-prestashop-1-6-manuellement-87 et tout re-fonctionne normalement ! si cela peut aider...
  11. Bonjour je suis à la recherche d'une méthode permettant d'ajouter les labels dans l'adresse générée par PS via la classe AddressFormat. j'ai paramétré le champs adresse ($invoice_address) qui apparait dans les factures notamment via l'administration > localisation > PAYS > France > Format de l'adresse. Mais cela n'affiche que les valeurs. ayant ajouté des champs personnalisés, il me faut les labels en plus : NOM PRENOM SOCIETE code XXX : VALEUR_DU_CODE .... Si vous avez une idée, je suis preneur !
  12. et bien je me réponds à moi même puisque j'ai trouvé la solution, comme un grand !! alors voila, il fallait aussi faire l'override de la classe OrderState class OrderState extends OrderStateCore { /** @var boolean Send an e-mail to accounting ? */ public $send_mail_accounting; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'order_state', 'primary' => 'id_order_state', 'multilang' => true, 'fields' => array( 'send_email' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'module_name' => array('type' => self::TYPE_STRING, 'validate' => 'isModuleName'), 'invoice' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor'), 'logable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'shipped' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'unremovable' =>array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'delivery' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'hidden' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'paid' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'send_mail_accounting' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), // Lang fields 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64), 'template' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isTplName', 'size' => 64), ), ); }
  13. Bonjour je souhaite ajouter une nouvelle colonne à la table XX_order_state. mon champs se nomme send_mail_accouting. Ce champs me permet d'ajouter un paramètre au statut de commande afin de réaliser une action supplémentaire. J'ai donc déjà : 1- ajouter le champs à la table xxx_order_state 2- overide de AdminStatuseController <?php class AdminStatusesController extends AdminStatusesControllerCore { /** * init all variables to render the order status list */ protected function initOrderStatutsList() { $this->addRowAction('edit'); $this->addRowAction('delete'); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash', ) ); $this->fields_list = array( 'id_order_state' => array( 'title' => $this->l('ID'), 'align' => 'text-center', 'class' => 'fixed-width-xs' ), 'name' => array( 'title' => $this->l('Name'), 'width' => 'auto', 'color' => 'color' ), 'logo' => array( 'title' => $this->l('Icon'), 'align' => 'text-center', 'image' => 'os', 'orderby' => false, 'search' => false, 'class' => 'fixed-width-xs' ), 'send_email' => array( 'title' => $this->l('Send email to customer'), 'align' => 'text-center', 'active' => 'sendEmail', 'type' => 'bool', 'ajax' => true, 'orderby' => false, 'class' => 'fixed-width-sm' ), 'delivery' => array( 'title' => $this->l('Delivery'), 'align' => 'text-center', 'active' => 'delivery', 'type' => 'bool', 'ajax' => true, 'orderby' => false, 'class' => 'fixed-width-sm' ) , 'invoice' => array( 'title' => $this->l('Invoice'), 'align' => 'text-center', 'active' => 'invoice', 'type' => 'bool', 'ajax' => true, 'orderby' => false, 'class' => 'fixed-width-sm' ), 'template' => array( 'title' => $this->l('Email template') ), 'send_mail_accounting' => array( 'title' => $this->l('Send email to accounting'), 'align' => 'text-center', 'active' => 'sendMailAccounting', 'type' => 'bool', 'ajax' => true, 'orderby' => false, 'class' => 'fixed-width-sm' ) ); } public function renderForm() { $this->fields_form = array( 'tinymce' => true, 'legend' => array( 'title' => $this->l('Order status'), 'icon' => 'icon-time' ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Status name'), 'name' => 'name', 'lang' => true, 'required' => true, 'hint' => array( $this->l('Order status (e.g. \'Pending\').'), $this->l('Invalid characters: numbers and').' !<>,;?=+()@#"{}_$%:' ) ), array( 'type' => 'file', 'label' => $this->l('Icon'), 'name' => 'icon', 'hint' => $this->l('Upload an icon from your computer (File type: .gif, suggested size: 16x16).') ), array( 'type' => 'color', 'label' => $this->l('Color'), 'name' => 'color', 'hint' => $this->l('Status will be highlighted in this color. HTML colors only.').' "lightblue", "#CC6600")' ), array( 'type' => 'checkbox', 'name' => 'logable', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Consider the associated order as validated.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'checkbox', 'name' => 'invoice', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Allow a customer to download and view PDF versions of his/her invoices.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'checkbox', 'name' => 'hidden', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Hide this status in all customer orders.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'checkbox', 'name' => 'send_email', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Send an email to the customer when his/her order status has changed.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'checkbox', 'name' => 'shipped', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Set the order as shipped.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'checkbox', 'name' => 'paid', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Set the order as paid.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'checkbox', 'name' => 'delivery', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Show delivery PDF.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'checkbox', 'name' => 'send_mail_accounting', 'values' => array( 'query' => array( array('id' => 'on', 'name' => $this->l('Send an email to the accounting when his/her order status has changed.'), 'val' => '1'), ), 'id' => 'id', 'name' => 'name' ) ), array( 'type' => 'select_template', 'label' => $this->l('Template'), 'name' => 'template', 'lang' => true, 'options' => array( 'query' => $this->getTemplates($this->context->language->iso_code), 'id' => 'id', 'name' => 'name' ), 'hint' => array( $this->l('Only letters, numbers and underscores ("_") are allowed.'), $this->l('Email template for both .html and .txt.') ) ) ), 'submit' => array( 'title' => $this->l('Save'), ) ); if (Tools::isSubmit('updateorder_state') || Tools::isSubmit('addorder_state')) return $this->renderOrderStatusForm(); else if (Tools::isSubmit('updateorder_return_state') || Tools::isSubmit('addorder_return_state')) return $this->renderOrderReturnsForm(); else return AdminController::renderForm(); } protected function renderOrderStatusForm() { if (!($obj = $this->loadObject(true))) return; $this->fields_value = array( 'logable_on' => $this->getFieldValue($obj, 'logable'), 'invoice_on' => $this->getFieldValue($obj, 'invoice'), 'hidden_on' => $this->getFieldValue($obj, 'hidden'), 'send_email_on' => $this->getFieldValue($obj, 'send_email'), 'shipped_on' => $this->getFieldValue($obj, 'shipped'), 'paid_on' => $this->getFieldValue($obj, 'paid'), 'delivery_on' => $this->getFieldValue($obj, 'delivery'), 'send_mail_accounting_on' => $this->getFieldValue($obj, 'send_mail_accounting'), ); if ($this->getFieldValue($obj, 'color') !== false) $this->fields_value['color'] = $this->getFieldValue($obj, 'color'); else $this->fields_value['color'] = "#ffffff"; return AdminController::renderForm(); } public function postProcess() { if (Tools::isSubmit($this->table.'Orderby') || Tools::isSubmit($this->table.'Orderway')) $this->filter = true; if (Tools::isSubmit('submitAddorder_return_state')) { $id_order_return_state = Tools::getValue('id_order_return_state'); // Create Object OrderReturnState $order_return_state = new OrderReturnState((int)$id_order_return_state); $order_return_state->color = Tools::getValue('color'); $order_return_state->name = array(); $languages = Language::getLanguages(false); foreach ($languages as $language) $order_return_state->name[$language['id_lang']] = Tools::getValue('name_'.$language['id_lang']); // Update object if (!$order_return_state->save()) $this->errors[] = Tools::displayError('An error has occurred: Can\'t save the current order\'s return status.'); else Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token); } if (Tools::isSubmit('submitBulkdeleteorder_return_state')) { $this->className = 'OrderReturnState'; $this->table = 'order_return_state'; $this->boxes = Tools::getValue('order_return_stateBox'); AdminController::processBulkDelete(); } if (Tools::isSubmit('deleteorder_return_state')) { $id_order_return_state = Tools::getValue('id_order_return_state'); // Create Object OrderReturnState $order_return_state = new OrderReturnState((int)$id_order_return_state); if (!$order_return_state->delete()) $this->errors[] = Tools::displayError('An error has occurred: Can\'t delete the current order\'s return status.'); else Tools::redirectAdmin(self::$currentIndex.'&conf=1&token='.$this->token); } if (Tools::isSubmit('submitAdd'.$this->table)) { $this->deleted = false; // Disabling saving historisation $_POST['invoice'] = (int)Tools::getValue('invoice_on'); $_POST['logable'] = (int)Tools::getValue('logable_on'); $_POST['send_email'] = (int)Tools::getValue('send_email_on'); $_POST['hidden'] = (int)Tools::getValue('hidden_on'); $_POST['shipped'] = (int)Tools::getValue('shipped_on'); $_POST['paid'] = (int)Tools::getValue('paid_on'); $_POST['delivery'] = (int)Tools::getValue('delivery_on'); $_POST['send_mail_accounting'] = (int)Tools::getValue('send_mail_accounting_on'); if (!$_POST['send_email']) { $languages = Language::getLanguages(false); foreach ($languages as $language) $_POST['template_'.$language['id_lang']] = ''; } return AdminController::postProcess(); } else if (Tools::isSubmit('delete'.$this->table)) { $order_state = new OrderState(Tools::getValue('id_order_state'), $this->context->language->id); if (!$order_state->isRemovable()) $this->errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); else return AdminController::postProcess(); } else if (Tools::isSubmit('submitBulkdelete'.$this->table)) { foreach (Tools::getValue($this->table.'Box') as $selection) { $order_state = new OrderState((int)$selection, $this->context->language->id); if (!$order_state->isRemovable()) { $this->errors[] = $this->l('For security reasons, you cannot delete default order statuses.'); break; } } if (!count($this->errors)) return AdminController::postProcess(); } else return AdminController::postProcess(); } public function ajaxProcessSendMailAccountingOrderState() { $id_order_state = (int)Tools::getValue('id_order_state'); $sql = 'UPDATE '._DB_PREFIX_.'order_state SET `send_mail_accounting`= NOT `send_mail_accounting` WHERE id_order_state='.$id_order_state; $result = Db::getInstance()->execute($sql); if ($result) echo json_encode(array('success' => 1, 'text' => $this->l('The status has been updated successfully.'))); else echo json_encode(array('success' => 0, 'text' => $this->l('An error occurred while updating this meta.'))); } } Ce nouveau champs apparaît bien dans la la liste des statuts : Mais je n'arrive pas à récupérer la valeur dans le formulaire : il semble que ce soit le retour de $this->fields_value() qui ne me renvoit pas dans la méthode renderOrderStatusForm : 'send_mail_accounting_on' => $this->getFieldValue($obj, 'send_mail_accounting'), Si quelqu'un a une idée ?
  14. @Bondaty and Co attention l'intégration est faite via CDN (connexion internet requise si serveur de dév) je continue à chercher puisque je ne me souvenais plus que le FrontController était censé charger en autoload les fichiers js et css présents dans les répertoires du même nom. il y avait déjà une petite erreur de syntaxe : // Automatically add js files from js/autoload directory in the template if (@filemtime($this->getThemeDir().'js/autoload/')) foreach (scandir($this->getThemeDir().'js/autoload/', 0) as $file){ // if (preg_match('/^[^.].*\.js$/', $file)) $this->addJS($this->getThemeDir().'js/autoload/'.$file); if (preg_match('/^[^.].*\.js$/', $file)) $this->addJS(_THEME_JS_DIR_.'js/autoload/'.$file); } // Automatically add css files from css/autoload directory in the template if (@filemtime($this->getThemeDir().'css/autoload/')) foreach (scandir($this->getThemeDir().'css/autoload', 0) as $file){ //if (preg_match('/^[^.].*\.css$/', $file)) $this->addCSS($this->getThemeDir().'css/autoload/'.$file); if (preg_match('/^[^.].*\.css$/', $file)) $this->addJS(_THEME_CSS_DIR_.'js/autoload/'.$file); } j'ai bien vérifié qu'il scannait bien le bon répertoire de thème enfant, mais il semble qu'il y a ait un problème avec le $this->addJS, puisque les fichiers ne sont pas chargés...
  15. Bonjour, j'ai rencontré le même problème et je suis allé du coup vérifié l'intégration de bootstrap dans le thème... Auparavant, afin de développer mon propre thème, j'ai créé un thème enfant.... et là, à ma grande surprise, il n'y a pas d'intégration de jQuery [http://jquery.com/download/] et des scripts Bootstrap (bootstrap.js) [http://getbootstrap.com/getting-started/] j'ai donc directement ajouté en bas de footer.tpl les deux scripts : {* * 2007-2014 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2014 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {if !$content_only} </div><!-- #center_column --> {if isset($right_column_size) && !empty($right_column_size)} <div id="right_column" class="col-xs-12 col-sm-{$right_column_size|intval} column">{$HOOK_RIGHT_COLUMN}</div> {/if} </div><!-- .row --> </div><!-- #columns --> </div><!-- .columns-container --> <!-- Footer --> <div class="footer-container"> <footer id="footer" class="container"> <div class="row">{$HOOK_FOOTER}</div> </footer> </div><!-- #footer --> </div><!-- #page --> {/if} {include file="$tpl_dir./global.tpl"} <!-- Latest compiled and minified JavaScript --> <script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> </body> </html> Et tout à l'air ok maintenant...
×
×
  • Create New...