Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.


Popular Content

Showing content with the highest reputation on 07/22/2021 in all areas

  1. 2 points
    Simple and fast - Create file order_status.php: <?php $allow = array("", "", ""); //allowed IPs if(!in_array($_SERVER['REMOTE_ADDR'], $allow) && !in_array($_SERVER["HTTP_X_FORWARDED_FOR"], $allow)) { header("Location: http://youraddress.com"); //redirect exit(); } require(dirname(__FILE__).'/config/config.inc.php'); if(isset($_GET['data'])){ $name = $_GET['data']; $new_order_state = 34; $get_orders = array(); array_push($get_orders,$name); foreach ($get_orders as $orders) { $order = new Order($orders); $_state = (int) $order->current_state; if ($_state == $new_order_state) {Continue;} elseif ($_state == 33 ) { $history = new OrderHistory(); $history->id_order = (int)$order->id; $history->changeIdOrderState((int) $new_order_state, $order->id); if ($history->save()) {echo '<div class="ok-status"> OK - '.$orders.' </div><br />';} else {echo '<div class="nok-status"> Error - '.$orders.' </div><br />';} } } } else { $name = "Empty"; } ?> <style> .ok-status { font-weight: 600; font-size: 50px; line-height: 60px; color: green; } .nok-status { font-weight: 600; font-size: 50px; line-height: 60px; color: red; } .send-input { height: 65px; width: 300px; font-weight: 600; font-size: 50px; line-height: 60px; } .send-button { height: 65px; width: 150px; font-weight: 600; font-size: 50px; line-height: 60px; background-color: #0093d4;} </style> <?php echo "<form method='get' name='form' action='order_status.php'> <input type='text' placeholder='ID ...' id='focus' class='send-input' maxlength='6' minlength='6' name='data'> <input type='submit' class='send-button' value='OK'> </form>"; ?> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script> <script> $(document).ready(function(){ $('#focus').focus(); }); $("body").click(function(){ $('#focus').focus(); }); </script> <? On top u can allow access only to your IP. So $new_order_state = 34; ( here u set up new state with id, u can look it up in backend - orders - statuses ), next u can edit this part: elseif ($_state == 33 ) ( so for me it means it wont update state to 34 if original state wasnt 33 u can change it by yourself - for example: elseif ($_state != 33 ) means it update every order but with state 33 and so on.. ) Style - customize as u wish Form part, u can also carefully edit it by yourself, we have orders with id 160000+ so i set up max a min length to 6 characters. (action calls to itself so same as we named our file - order_status.php ) Next we call jquery and few simple lines to autofocus input after realod and by clicking on body. Save file and upload it to root of yr TB - to access script just type /order_status.php after yr domain. (we use iframe in prestato display it on dashboard and etc ) We use barcode scanner to scan id from invoice, then u dont have to type, u just scan, scan, scan,... Thats it 😉 I do recomment testing it on your demo / test first..
  2. 1 point
    Thanks a lot for your contribution! 😎 I always love to see, when other merchants are improving things with custom code 👍 We have very similair functions as we also work with barcode scanners. I have not tested your code, but I would strongly recommend you, to add it as ModuleAdminController and not with such an external file. By that you gain already security as it will be only available if the user is logged in. Codewise this looks a bit unsecure on overcomplicate to me. $name = $_GET['data']; $new_order_state = 34; $get_orders = array(); array_push($get_orders,$name); foreach ($get_orders as $orders) { } As far as I understand, you scan one code after another. If this is true, you wouldn't need any foreach loop. You could then very simply to this: $id_order = (int)$_GET['data']; // Note the (int) does improve security $order = new \Order($id_order) // Continue with your stuff Maybe this helps you a little bit 😊
  3. 1 point
    The default theme shows every relevant feature at the base of the product page, in a table. The backoffice allows you to change the order of features, in <div class = "features> for formatting. I can't find a way to put meta tags into features (or tags), or round the default feature table, so here is a work-around. I already had feature 33 set to color and 32 set to google product category. <div class="features"> {foreach from=$features item=feature name=pr_features} {if $feature.id_feature == 33 }<p>Colour: <span title="https://schema.org/Product" itemprop="color">{$feature.value}</span></p>{/if} {/foreach} {foreach from=$features item=feature name=pr_features} {if $feature.id_feature == 32 }<p><span >Google Product Category</span>: <g:google_product_category>{$feature.value}</g:google_product_category></p>{/if} {/foreach} </div> That's it! I haven't made it neat; I just repeat the tagged features at the bottom of the page, but it works.. (There are other work-arounds for shipping dimensions and weight, or product id . Another way is to put some code into the long description, if html cleaner is turned-off, or you might have an unused field like UPC or EAN and use it for something else, changing the tags round it).
  • Create New...