Jump to content

PhpMadman

Members
  • Posts

    277
  • Joined

  • Last visited

  • Days Won

    1

Community Answers

  1. PhpMadman's post in Highlighting COD orders in orders list at BO was marked as the answer   
    Excellent. Then that code works.
    Now we just need to add a few more lines in to another file.
    classes/AdminTab.php


    Step 1
    Replace this
    if (!isset($params['position']) AND (!isset($this->noLink) OR !$this->noLink)) echo ' onclick="document.location = \''.$currentIndex.'&'.$this->identifier.'='.$id.($this->view? '&view' : '&update').$this->table.'&token='.($token!=NULL ? $token : $this->token).'\'">'.(isset($params['prefix']) ? $params['prefix'] : ''); else echo '>'; With this. I just added some brackets { }
    if (!isset($params['position']) AND (!isset($this->noLink) OR !$this->noLink)) { echo ' onclick="document.location = \''.$currentIndex.'&'.$this->identifier.'='.$id.($this->view? '&view' : '&update').$this->table.'&token='.($token!=NULL ? $token : $this->token).'\'">'.(isset($params['prefix']) ? $params['prefix'] : ''); } else { echo '>'; } Save, and test the file.
     
     
    Step 2
    Add the color support to our previous code
    It's just adding 3 lines after 1477
    if (isset($params['color'])) { echo '<span class="label color_field" style="background-color:'.$tr[$params['color']].';color:'.(Tools::getBrightness($tr[$params['color']]) < 128 ? 'white' : '#383838').'">'; } Now you should have this.
    if (!isset($params['position']) AND (!isset($this->noLink) OR !$this->noLink)) { echo ' onclick="document.location = \''.$currentIndex.'&'.$this->identifier.'='.$id.($this->view? '&view' : '&update').$this->table.'&token='.($token!=NULL ? $token : $this->token).'\'">'.(isset($params['prefix']) ? $params['prefix'] : ''); if (isset($params['color'])) { echo '<span class="label color_field" style="background-color:'.$params['color'].';color:'.(Tools::getBrightness($params['color']) < 128 ? 'white' : '#383838').'">'; } } else { echo '>'; } Now, let's add the closing tag.
     
     
    Step 3
    Now, your lines on rows 1539-1540 should currently look like this.
    echo (isset($params['suffix']) ? $params['suffix'] : ''). '</td>'; We need to add a line before the </td> line.
    echo (isset($params['suffix']) ? $params['suffix'] : ''). (isset($params['color']) ? '</span>' : ''). '</td>'; Now it supports color.
    Either edit your admin.css to include .label or .color_field, and add display: inline to it.
    Or you can edit the element directly and change the color line we created earlier to
     echo '<span class="label color_field" style="display:inline;background-color:'.$params['color'].';color:'.(Tools::getBrightness($params['color']) < 128 ? 'white' : '#383838').'">'; Hope this helps.
  2. PhpMadman's post in Change an Address Alias Field From Text Input to Checkbox was marked as the answer   
    Completely untested.
    This should give the options Home and Business. With both label and value translatable.
    <!--<label for="alias">{l s='Please assign an address title for future reference.'} <sup>*</sup></label>--> <!--<input type="text" id="alias" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{elseif isset($address->alias)}{$address->alias|escape:'html':'UTF-8'}{elseif !$select_address}{l s='My address'}{/if}" />--> <span>{l s='Please assign an address title for future reference.'} <sup>*</sup></span> <label for="alias_home"> {l s='Home'}</label> <input type="radio" id="alias_home" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{l s='Home'}" /> <label for="alias_business"> {l s='Business'}</label> <input type="radio" id="alias_business" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{l s='Business'}" />
  3. PhpMadman's post in SQL command won't exec in a module was marked as the answer   
    I recomend doing a p($sqlSearchProd)
    Then you will see if something is missing, and you can also try to run it manually to check if there are any errors in code.
    Also you don't seem to use the correct sign (`) around the ._DB_PREFIX_.'order_detail.
    and in order_detail it's product_id and not id_product for some reason.
  4. PhpMadman's post in Hook at the order page (HOOK_TAB_SHIP) was marked as the answer   
    Hello.
     
    The original pullrequest: https://github.com/PrestaShop/PrestaShop/pull/1844
    The module used for testing: https://github.com/PhpMadman/TestModule/tree/DisplayAdminOrderHooks
     
    Hope this help.
    The hooks are a 2 part system. HOOK_TAB_X and HOOK_CONTENT_X
  5. PhpMadman's post in [SOLVED] Ajax call from module was marked as the answer   
    It's working now!
    <?php include_once(dirname(__FILE__).'../../../config/config.inc.php'); include_once(dirname(__FILE__).'../../../init.php'); switch (Tools::getValue('method')) {     case 'myMethod' :         $return = array('result' => 'my really shitty value');         echo json_encode($return);         break;     default:         exit; } ?> So... My guess, it was the require_once that screwed with it.
  6. PhpMadman's post in [SOLVED] Add javascript to module, extending form.tpl was marked as the answer   
    I removed JS from tpl, and did this instead
    public function hookActionAdminControllerSetMedia($params) { // add necessary javascript to back office if($this->context->controller->controller_name == 'AdminModules' && Tools::getValue('configure') == $this->name && Tools::getValue('tab_module') == 'administration' && Tools::getValue('module_name') == $this->name) { $this->context->controller->addJS($this->_path.'views/templates/_configure/helpers/form/form.js'); } } All of the if is requierd, beacuse the hook is executed on EVERY BO PAGE according to the forum posts I found.
  7. PhpMadman's post in [SOLVED] Custom module does not install DB tables was marked as the answer   
    This is the porper way to do it.
    All functions must return 1 or true, else it will report failed install.
    public function install() { if (!parent::install() || !$this->_installDB() || !$this->_populateDB() || !$this->_checkConfig() || !$this->registerHook('actionAdminControllerSetMedia') ) return false; return true; }
  8. PhpMadman's post in [SOLVED] Insert line between rows of products listing was marked as the answer   
    in porductlist.css
     
    change to this (around line 4)
    #product_list li { border-bottom: 1px solid #EEEEEE;
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More