JaivyDaam Posted April 7, 2014 Share Posted April 7, 2014 Hello All! First, sorry for my slubby english and louzy explanation any questions about my problem will be awnsered the best i can! So let me explain what i am trying to do here: For my own administration i need order numbers to be like '2140001' 214(is year) 0001(following number) when a customer orders, the order number needs to be created and added to a different table 'order_number' with only id_order and order_number... But when administrators add an order in the BO, there is not always an order, when we use products to repay a dept to a b2b customer there should be no order number. This way Reference is not capable of such thing since it's mandatory. So now, i want to add some kind of jquery box to the top of my detailed order page, so i created a module and hooked it to displayBackOfficeHeader, useing regexp to determine the page i am in and using strpos to determine if 'vieworder' is in the url. public function hookBackofficeHeader($params) { $page = preg_replace('/(.*)(tab=Admin|controller=Admin)([^&]+)(&.*)/','${3}',$_SERVER['REQUEST_URI']); $url = $_SERVER['REQUEST_URI']; $str = 'vieworder'; $version = explode('.',_PS_VERSION_); $script = ''; switch(strtolower($page)) { case 'orders': if ($version[1] == 5 || $version[1] == 6 && strpos($url, $str)) $script.= self::regenHtaccess(); break; case 'preferences': if ($version[1] == 3 || $version[1] == 4) $script.= self::clearCache(); break; case 'performance': if ($version[1] == 4 || ($version[1] == 5 && $version[2] < 6)) $script.= self::clearCache(); break; case 'meta': if ($version[1] == 5 || $version[1] == 6) $script.= self::regenHtaccess(); break; case 'shipping': if ($version[1] == 5 && $version[2] >= 6) $script.= self::psShippingMethod(); //if ($version[1] == 5 && $version[2] >= 4) $script.= self::psCarrierDefault(); break; } if ($version[1] >= 4) $script .= self::langSelect(); return $script; } regenHtaccess function: private function regenHtaccess($mode = null) { if ($mode == 'run') { $ht_file = _PS_ROOT_DIR_.'/.htaccess'; if (Tools::generateHtaccess($ht_file, null, null, '', Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS'), false, Tools::getValue('PS_HTACCESS_DISABLE_MODSEC'))) { Tools::enableCache(); Tools::clearCache($this->context->smarty); Tools::restoreCacheSettings(); die(0); } die('Failed in '.__METHOD__); } return <<< EOF <script> function esaPost(request){ $.ajax( { url: "{$this->getPostUrl()}&q="+request, cache: false, success: function(ret) { var probe = ret; } } ); return false; } $(document).ready(function() { if ($.last == undefined) { $.fn.eq = function( i ) { var len = this.length, j = +i + ( i < 0 ? len : 0 ); return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); }; } var lf = $('#content form,#content fieldset').eq(0); $('<fieldset class="panel"><legend>{$this->l('Force regenerate .htaccess')}</legend><div class="margin-form" style="padding-top:5px;"><a class="button" onclick="return esaPost(\'regenHtaccess\')" href="#">{$this->l('Force regenerate .htaccess')}</a><span id="esaRegenHT"></span></div></fieldset><br />') .insertBefore(lf); $('#esaRegenHT').html(" {$this->l('Regenerate this shop .htaccess with current setting')}"); }); </script> EOF; } Ok so, when i go to Preferences->SEO & URLS, the regenHtaccess box shows up like it should, but for some reasong i am unable to add a box to detailed order page. i am stuck, and i need some professional help! Thank you in advance! Jaivy Daam 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