Jump to content

oowwaa

Members
  • Posts

    15
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

oowwaa's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Merci pour le retour, la prise en compte des dimensions (ou du volume) est secondaire, le plus important est de pouvoir prendre en compte la valeur et le poids et eventuellement appliquer des formules differentes en fonction de la plage / zone geographique. Est il vraiment necessaire de creer un nouveau module?
  2. Bonjour, Je cherche un moyen pour prendre en charge les formules dans le calcul des frais de port en addition au system actuel de plage de valeur / poids. Permettre l'utilisation de formules permettrai de reduire significativement le nombre de tranches / entrée et d'augmenter la precision du calcul des frais de port. Idealement je cherche a ce que les cellules du tableau des frais de port (tab 2 Destinations d'expedition et couts) puisse accepter soit une valeur soit une formule et gerer un nombre limités de variables : [PRICE] [WEIGHT] [WIDTH] [LENGTH] [HEIGHT] example de formule qui prends en compte le prix, le poids et le volume : 1.56 + (0.012*[PRICE]) + (6.2*[WEIGHT]) + (2.55*(([WIDTH]*[LENGTH]*[HEIGHT])/1000)) Je n'ai pas trouvé d'exemples et ni veritablement comment operer une telle modification, j'ai pu trouver certains des fichiers responsables du calcul des frais de port dans cart.php et carriers.php mais pas le fichier responsable de la page du backoffice, toute suggestion sera bienvenue quand a la maniere de modifier les cellules du tableau pour accepter une formule et interpreter les variables. Merci.
  3. du coup, proprement cela donne public function printAddressField($formatAddress){ $this->context->smarty->assign('formatAddress', $formatAddress); return $this->createTemplate('_print_address_field.tpl')->fetch(); }
  4. J'ai enfin trouvé comment transferer les données au champ de texte editable, le callback peut prendre un argument, qui correspond au resultat de la clause select transmis a la liste des champs, il fallait le deviner... le callback public function printAddressField($formatAddress){ return '<span class="btn-group-action"> <textarea name="addressTextArea" id="addressTextArea" rows="5" cols="40" >'.$formatAddress.' </textarea> </span>'; } l'override de contruct() public function __construct(){ parent::__construct(); $this->_select .= ', a.id_order as id_trackingField, a.id_order as id_manageBtns, address.`address1` as id_addressField, CONCAT( address.`firstname`," ", address.`lastname`, "\n", address.`address1`, \' \', address.`address2`, "\n", address.`postcode`," ", address.`city`, "\n", country_lang.`name`,\' \' ) as id_addressFull '; $this->fields_list = array_merge($this->fields_list, array( 'id_addressFull' => array( 'title' => $this->trans('Address', array(), 'Admin.Global'), 'align' => 'text-left', 'callback' => 'printAddressField', 'orderby' => false, 'search' => false, 'remove_onclick' => true ), )); } Maintenant il ne me reste plus qu'a trouver comment recuperer le contenu de la commande avec une clause select pour un autre champ. N.B Assigner la variable a smarty etait une tentative pour peupler (indirectement) le champ de texte editable
  5. Non j'ai fait l'essais, cette function est appelée lors que l'utilisation du bouton "ajouter une commande" (addorder), mais elle n'est jamais appelée lors de la construction de la liste des commandes. Edit: la seule autre fonction appelée au moment du chargement de la liste des comandes dans ce controlleur est renderList() public function renderList() { if (Tools::isSubmit('submitBulkupdateOrderStatus'.$this->table)) { if (Tools::getIsset('cancel')) { Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token); } $this->tpl_list_vars['updateOrderStatus_mode'] = true; $this->tpl_list_vars['order_statuses'] = $this->statuses_array; $this->tpl_list_vars['REQUEST_URI'] = $_SERVER['REQUEST_URI']; $this->tpl_list_vars['POST'] = $_POST; } var_dump($this->address.sAddressFull); die(); return parent::renderList(); } le var_dump done string(12) "sAddressFull", la variable n'est pas reconnue et interpretée comme string. Une autre fonction doit etre reponsable du remplissage de tous les champs pour chque ligne, peut etre parent:renderList()
  6. Oui j''en ai peur, je copie l'override complete : <?php class AdminOrdersController extends AdminOrdersControllerCore { public $addressTest; public $order; public function printTrackingField(){ return $this->createTemplate('_print_tracking_field.tpl')->fetch(); } public function printAddressField(){ return $this->createTemplate('_print_address_field.tpl')->fetch(); } public function printManageButtons(){ return $this->createTemplate('_print_manage_buttons.tpl')->fetch(); } public function __construct(){ parent::__construct(); $this->addJS('prestashop/prestashop/override/js/DYMO.Label.Framework.2.0.2.js'); $this->addJS('prestashop/prestashop/override/js/dymo.js'); $this->_select = ' a.id_currency, a.id_order AS id_pdf, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`, IF((SELECT so.id_order FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new, country_lang.name as cname, IF(a.valid, 1, 0) badge_success'; $this->_join = ' LEFT JOIN `'._DB_PREFIX_.'order_carrier` oc ON a.`id_order` = oc.`id_order` LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = '.(int)$this->context->language->id.') LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`) LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')'; $this->_orderBy = 'id_order'; $this->_orderWay = 'DESC'; $this->_use_found_rows = true; $statuses = OrderState::getOrderStates((int)$this->context->language->id); foreach ($statuses as $status) { $this->statuses_array[$status['id_order_state']] = $status['name']; } $this->fields_list = array( 'id_order' => array( 'title' => $this->l('ID'), 'align' => 'text-center', 'class' => 'fixed-width-xs' ), 'reference' => array( 'title' => $this->l('Reference') ), 'tracking_number' => array( 'title' => $this->l('tracking number'), 'havingFilter' => true, ), 'new' => array( 'title' => $this->trans('New client', array(), 'Admin.Orderscustomers.Feature'), 'align' => 'text-center', 'type' => 'bool', 'tmpTableFilter' => true, 'orderby' => false, ), 'customer' => array( 'title' => $this->trans('Customer', array(), 'Admin.Global'), 'havingFilter' => true, ), ); $this->_select .= ', a.id_order as id_trackingField, a.id_order as id_manageBtns, address.`address1` as id_addressField, CONCAT( address.`firstname`," ", address.`lastname`, "\n", address.`address1`, \' \', address.`address2`, \' \', address.`postcode`," ", address.`city`, \' \', country_lang.`name`,\' \' ) as sAddressFull '; //$formatAddress = $this->address.sAddressFull; //$formatAddress = $this->sAddressFull; $formatAddress = $this->id_addressField; var_dump($formatAddress); die(); //$formatAddress = "test\nformated\nAddress"; $this->fields_list['sAddressFull'] = array( 'title' => $this->l('Address tester'), 'value' => $formatAddress ); $this->context->smarty->assign('formatAddress', $formatAddress); $this->fields_list = array_merge($this->fields_list, array( 'id_trackingField' => array( 'title' => $this->trans('Tracking', array(), 'Admin.Global'), 'align' => 'text-left', 'callback' => 'printTrackingField', 'orderby' => false, 'search' => false, 'remove_onclick' => true ), 'id_addressField' => array( 'title' => $this->trans('Address', array(), 'Admin.Global'), 'align' => 'text-left', 'callback' => 'printAddressField', 'orderby' => false, 'search' => false, 'remove_onclick' => true ), 'id_manageBtns' => array( 'title' => $this->trans('Manage', array(), 'Admin.Global'), 'align' => 'text-left', 'callback' => 'printManageButtons', 'orderby' => false, 'search' => false, 'remove_onclick' => true ) )); } }
  7. J'ai essayé quelques autres champs de la clause select mais meme erreur //$formatAddress = $this->address.sAddressFull; //$formatAddress = $this->sAddressFull; $formatAddress = $this->id_addressField; var_dump($formatAddress); die();
  8. Ca donne une erreur mais je crois que je commence a comprendre ContextErrorException in AdminOrdersController.php line 111:Notice: Undefined property: AdminOrdersController::$addressin AdminOrdersController.php line 111 at ErrorHandler->handleError('8', 'Undefined property: AdminOrdersController::$address',
  9. Wow, merci beaucoup, je n'aurais jamais été chercher dans category.php et _partials/miniature, j'espere que tous ces fichiers src pourront un jour etre overridés facilement. J'ai un autre probleme de champ custom sur la liste des commandes, j'ai deux champs editables afin d'ajouter le numero de suivi et modifier l'addresse a la volée directement depuis la liste des commandes. Les modifications ont été faites dans une override de AdmiOrderController.php et dans les fichiers tpl. Les champs sont bien affichés, je peux leur assigner le contenu d'une variable, j'arrive a recuperer les données pour chaque commande (addresse formatée) mais uniquement avec $this->_select et je n'arrive pas assigner le resultat (addresse formatée ici) a une variable (ensuite injectée par smarty). J'arrive uniquement a afficher le resultat dans $this->fields_list (ici ca fonctionne dans le champ non editable Address tester), ce dont j'ai besoin c'est d'assigner ce resultat a $formatAddress Quelle est la bonne maniere de proceder? $this->_select .= ', a.id_order as id_trackingField, address.`address1` as id_addressField, CONCAT( address.`firstname`," ", address.`lastname`, "\n", address.`address1`, \' \', address.`address2`, \' \', address.`postcode`," ", address.`city`, \' \', country_lang.`name`,\' \' ) as sAddressFull '; $formatAddress = "test\nformated\nAddress"; $this->context->smarty->assign('formatAddress', $formatAddress); $this->fields_list['sAddressFull'] = array( 'title' => $this->l('Address tester'), 'value' => $formatAddress ); $this->fields_list = array_merge($this->fields_list, array( 'id_trackingField' => array( 'title' => $this->trans('Tracking', array(), 'Admin.Global'), 'align' => 'text-left', 'callback' => 'printTrackingField', 'orderby' => false, 'search' => false, 'remove_onclick' => true ), 'id_addressField' => array( 'title' => $this->trans('Address', array(), 'Admin.Global'), 'align' => 'text-left', 'callback' => 'printAddressField', 'orderby' => false, 'search' => false, 'remove_onclick' => true ), ));
  10. Merci pour ces indications fort utiles. Le champ produit additionnel apparait bien dans la page produit du back office et il fonctionne parfaitement, j'aimerai avoir ce champ egalement dans la liste des produits. J'ai edité /src/PrestaShopBundle/Resources/views/Admin/Product/list.html et j'obtiens bien le champ dans la liste des produits pour autant il reste vide, alors qu'il est sauvegardé et affiché correctement dans la page du produit. Reste t'il autre chose a editer pour peupler le champ dans la liste, peut etre au niveau de /themes/classic/templates/catalog ? je n'ai rien trouvé. Merci.
  11. Thanks for these precious indications. I try to change the field for a simple text field rather than HTML tab. Everything works when i use form.step1 HTML field, if i change for from.html.twig for form.step6 (text field) or any for other type i got errors, does anyone know what i am missing? <h2> [spam-filter] "Short name"|trans({}, 'Admin.Catalog.Feature') [spam-filter] <span class="help-box" data-toggle="popover" data-content="[spam-filter] "Add short name. Allowed special characters: .-_#\."|trans({}, 'Admin.Catalog.Help') [spam-filter]" ></span> </h2> [spam-filter] form_errors(form.step6.short_name) [spam-filter] <div class="row"> <div class="col-xl-12 col-lg-12" id="short_name"> [spam-filter] form_widget(form.step6.short_name) [spam-filter] </div> </div> Neither the property "short_name" nor one of the methods "short_name()", "getshort_name()"/"isshort_name()" or "__call()" exist and have public access in class "Symfony\Component\Form\FormView" in "/home/www/ps2/src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig" at line 310.
  12. Hello, i have a $this->_select statement in my AdminOrdersController.php override, which add a column "Address tester" $this->_select .= ', address.`address1` as saddress, a.id_order as id_trackingField, a.id_order as id_manageBtns, a.id_order as id_addressField, CONCAT( address.`firstname`," ", address.`lastname`, "\n", address.`address1`, \' \', address.`address2`, \' \', address.`postcode`," ", address.`city`, \' \', country_lang.`name`,\' \' ) as sAddressFull '; $this->fields_list['sAddressFull'] = array( 'title' => $this->l('Address tester') ); It adds the correct address data in the "Address tester" column, however i need this data (sAddressFull) to be assigned to a variable instead, how to achieve this? $sql = new DbQuery(); $sql->from('order'); $sql->_select .= ', address.`address1` as saddress, CONCAT( address.`firstname`," ", address.`lastname`, "\n", address.`address1`, \' \', address.`address2`, \' \', address.`postcode`," ", address.`city`, \' \', country_lang.`name`,\' \' ) as sAddressFull '; $customVal = Db::getInstance()->getValue($sql); //$customVal = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); $this->context->smarty->assign('fullAddress',print_r ($customVal)); All my other attempts failed as well.
  13. Hello, i would like to add an editable text field and text area on extra columns in the orders list, these wil be used in conjunction with two extra buttons i (added in a _print_pdf_icon.tpl override) to print shipping slip in one clic (javascript printer handling is implemented) and to set order as shipped + add tracking number in a clic on the second button. Currently, i managed to add the two buttons in _print_pdf_icon.tpl and handle them from javasript (situated in page_header_toolbar.tpl), printing text area content with button clic works. Everything else is not working, i dont understand how to add the text area and the text field in extra columns, i only managed to add non editable text field from adminOrdersController.php but it didnt help to add a blank, editable one. And i have no idea how i can set the order as shipped (and provide the tracking number) from javascript, how should i do this? Also i wonder how to get the shipping address country which is needed in the text area, i managed to get street, zip and country only and on a non editable field, finally the text area is in the buttons column which is wrong of course. Thanks a bunch. EDIT, after few hours I managed to arrange few things, however i still fail to assign the result os $this->_select statement (sAddressFull) to the variable passed to to the tpl via smarty ($cantidad). Also i still have no idea how to set the order as shipped from the button and add the tracking number from the trackingField but i found : $order->shipping_number = $tracking_number; $order->update();
  14. Hello, I need to add 2 extra columns in the product page and in order page (back office), i have managed to add the two fields in the database (shelf_location and short_name) in product table, I also overrided the product.php and order.php to get these fields in the order_row node and product responses from webservice (used to manage prestashop from ERP). Finally i want to add a button (setting order as shipped) and a field for tracking number directly in the orders list cells, where should i do these cosmetical overrides? Thanks
  15. Hi, yes, definitely interested. I have a working implementation but it is incomplete (some entities are lacking, including orders). I am curious to know how you generate the POJO directly from synopsis, and i would be glad to see and test your implementation, and share what i got. Let me know
×
×
  • Create New...