X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Direct access to orders and items (https://forum.x-cart.com/showthread.php?t=26660)

Audiolines 11-16-2006 08:57 AM

Direct access to orders and items
 
So my guys wanted faster access to orders and items, for the purpose of direct access no matter what screen they were on.

Here is what i did:

in single/home.tpl insert:
Code:

<form action="order.php">
Order#<input type="text" name="orderid"><input type="submit" value="find">
</form>

<form action="product_modify.php">
Item(ID#)<input type="text" name="productid"><input type="submit" value="find">
</form>


directly after:
Code:

{if $login eq "" }
{ include file="auth.tpl"}
{else}
{ include file="admin/menu.tpl"}


here is an example:
http://www.audiolines.com/directsearch.jpg

Jerrad 11-16-2006 09:27 AM

Re: Direct access to orders and items
 
Thanks a lot for this very useful mod! :D/

Audiolines 11-16-2006 09:32 AM

Re: Direct access to orders and items
 
no problem

Scott DeToffol 11-16-2006 10:10 AM

Re: Direct access to orders and items
 
Nice, can you add a form field that will bring up SKU?

Audiolines 11-16-2006 10:15 AM

Re: Direct access to orders and items
 
its quite an easy change, our SKU's = our item ID, so this was not necessary.

example: if our item id = 12345
our sku is SKU12345

Audiolines 11-16-2006 10:16 AM

Re: Direct access to orders and items
 
im not quite sure how to make that happen, let me work on it and ill post when i got it

TJ Stephens 11-16-2006 11:47 AM

Re: Direct access to orders and items
 
Thank you! Been wanting to do this for a while. Sometime the simplest mods are the most useful.

eaglemobiles 11-27-2006 04:54 PM

Re: Direct access to orders and items
 
THANKS very useful mod

Audiolines 12-07-2006 11:59 AM

Re: Direct access to orders and items
 
anyone know how to make these searches sit inside one of those pretty blue boxes?

jessej 12-07-2006 02:38 PM

Re: Direct access to orders and items
 
Doesnt work for 4.1 im guessing.

Audiolines 12-07-2006 04:23 PM

Re: Direct access to orders and items
 
im not sure, its a simple expansion of the built in search function. i dont have 4.1 though.

girlsbits 12-13-2006 10:10 AM

Re: Direct access to orders and items
 
Works perfectly in 4.1.4 - thanks.

I have removed the "Submit" buttons though as I usually just press the enter key (also means that less space is taken on the page).

My code is:

<form action="order.php">
Order No.<input type="text" name="orderid" onclick="find">
</form>

<form action="product_modify.php">
Prod. ID<input type="text" name="productid" onclick="find">
</form>

Vacman 08-20-2007 03:26 PM

Re: Direct access to orders and items
 
And you can put the code into admin/menu_admin.tpl for 4.1.x users.

Andrew Gadsden 08-22-2007 05:10 AM

Re: Direct access to orders and items
 
1 Attachment(s)
4.1.8

I put Audioline's handy mod into one of the standard menu boxes as follows:

1. Create new file admin/quick_find.tpl
Code:

{capture name=menu}
<form action="order.php">
Order no<input type="text" name="orderid"><input type="submit" value="find">
</form>
<br />
<form action="product_modify.php">
SKU<input type="text" name="productid"><input type="submit" value="find">
</form>
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_quick_find menu_content=$smarty.capture.menu }

2. INSERT
Code:

{ include file="admin/quick_find.tpl"}
after
Code:

{ include file="admin/menu_admin.tpl" }
<br />

(or wherever you like)

3. Create a new language variable lbl.quick_find with whatever name you choose. (eg "Quick Find")

Attachment 534

Thanks Audioline.

tnpaintballers 10-25-2007 08:41 AM

Re: Direct access to orders and items
 
To have this in the header bar you just make these simple changes. I put this in my header bar since I already have to scroll up & down for the left menu. It has enough in it right now.

In admin_head.tpl change this code:
Code:

<tr>
    <td colspan="2" class="HeadThinLine"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td>
</tr>
<tr>
    <td colspan="2" class="HeadLine" align="right" height="22">
{if ($usertype eq "P" or $usertype eq "A") and $login and $all_languages_cnt gt 1}
<form action="{$smarty.server.REQUEST_URI|amp}" method="post" name="asl_form">
<table cellpadding="0" cellspacing="0">
<tr>
    <td class="TopLabel">{$lng.lbl_current_language}:&nbsp;</td>
    <td>
<input type="hidden" name="redirect" value="{$smarty.server.QUERY_STRING|amp}" />
<select name="asl" onchange="javascript: document.asl_form.submit()">
{section name=ai loop=$all_languages}
<option value="{$all_languages[ai].code}"{if $current_language eq $all_languages[ai].code} selected="selected"{/if}>{$all_languages[ai].language}</option>
{/section}
</select>
    </td>
</tr>
</table>
</form>
{else}
&nbsp;
{/if}
</td>
</tr>
<tr>
    <td colspan="2" class="HeadThinLine"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td>
</tr>


To this code:
Code:

<tr>
    <td colspan="3" class="HeadThinLine"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td>
</tr>
<tr>
    <td class="HeadLine" align="right" height="22">
{if ($usertype eq "P" or $usertype eq "A") and $login and $all_languages_cnt gt 1}
<form action="{$smarty.server.REQUEST_URI|amp}" method="post" name="asl_form">
<table cellpadding="0" cellspacing="0">
<tr>
    <td class="TopLabel">{$lng.lbl_current_language}:&nbsp;</td>
    <td>
<input type="hidden" name="redirect" value="{$smarty.server.QUERY_STRING|amp}" />
<select name="asl" onchange="javascript: document.asl_form.submit()">
{section name=ai loop=$all_languages}
<option value="{$all_languages[ai].code}"{if $current_language eq $all_languages[ai].code} selected="selected"{/if}>{$all_languages[ai].language}</option>
{/section}
</select>
    </td>
</tr>
</table>
</form>
{else}
&nbsp;
{/if}
</td>
<td class="HeadLine" align="right">
<form action="order.php">
Order ID:<input type="text" name="orderid"><input type="submit" value="find">
</form>
</td>
<td class="HeadLine">
<form action="product_modify.php">
Item ID:<input type="text" name="productid"><input type="submit" value="find">
</form>
</td>
</tr>
<tr>
    <td colspan="3" class="HeadThinLine"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /></td>
</tr>


Here is a picture:
http://www.tnpaintballers.com/images/xcart_mods/admin_header_bar_mod.jpg

tnpaintballers 10-25-2007 01:25 PM

Re: Direct access to orders and items
 
Quote:

Originally Posted by Scott DeToffol
Nice, can you add a form field that will bring up SKU?

I think I found a fix!

Quote:

Originally Posted by Audiolines
im not quite sure how to make that happen, let me work on it and ill post when i got it

This coding isn't the best, but it works so far. I tested it very little, so there might be some bugs. You can now search with SKU's or the productid.

If you pull up an item in your database viewing it as a customer would you see something like this in the URL: product.php?productid=16134, but the SKU you assigned this product would be SKU1234 or just 1234.

With the way this Direct access to orders worked initially is that you had to enter that longer 16134 as in the example above. If you needed to edit an item on your site you wouldn't know that number, but you would know the SKU number you assigned the item.

With this mod I have posted below you can select whether you want to search by your SKU number or that longer number which is the productid for the database.

For you advance users this allows you to search by either the productid = PID or productcode = SKU.

First thing is add these to input fields to the form to search for products
Quote:

<input type="radio" id="search_types" name="search_types" value="1" checked="checked" />SKU
<input type="radio" id="search_types" name="search_types" value="2" />PID
Also change the name of the input box from productid to search_id


In this file /include/product_modify.tpl add this code
Quote:

function get_productid($product_code) {
$category_query = db_query("SELECT productid FROM xcart_products WHERE productcode = '" . (int)$product_code . "'");
$category = mysql_fetch_array($category_query, MYSQL_ASSOC);

return $category['productid'];
}
if ($HTTP_POST_VARS['search_types'] == 1){
?>
<script type="text/javascript" language="JavaScript"><!--
setTimeout('Redirect()',500);
function Redirect()
{
location.href = '../provider/product_modify.php?productid=<?PHP echo get_productid($HTTP_POST_VARS['search_id']) ?>';
}
// --></script>
<?PHP
}elseif ($HTTP_POST_VARS['search_types'] == 2){
?>
<script type="text/javascript" language="JavaScript"><!--
setTimeout('Redirect()',500);
function Redirect()
{
location.href = '../provider/product_modify.php?productid=<?PHP echo $HTTP_POST_VARS['search_id'] ?>';
}
// --></script>
<?PHP
}


Right below this code
Quote:

ini_set("memory_limit", "32M");
This will work with girlsbits version that uses the onclick function.
http://www.tnpaintballers.com/images/xcart_mods/admin_header_bar_mod_2.jpg

chamberinternet 10-26-2007 06:28 AM

Re: Direct access to orders and items
 
Sweet ... Nice addition ..

tnpaintballers 10-26-2007 12:43 PM

Re: Direct access to orders and items
 
You will need to add this IF statement to hide these boxes if the admin isn't logged in. If not then anybody that gets to your Admin panel will see these input boxes.

Add this right before the opening <form> line of each form.
Code:

{if $login ne ''}


Add this right after the closing </form> line of each form.
Code:

{/if}


If you just want to copy & past then replace each form of the previous code I gave with this:

This is the Order Search form
Code:

{if $login ne ''}
<form action="order.php">
Order ID:<input type="text" name="orderid"><input type="submit" value="find">
</form>
{/if}



This is the Product Search form
Code:

{if $login ne ''}
<!--
*****************************************************************************************************************************************
*    The radio button value 1 will search by Product ID/SKU                                                                                *
*    The radio button value 2 will search by the productid which is the product id that is the autoincrement in the database!            *
*****************************************************************************************************************************************
-->

<form action="product_modify.php" method="POST">
Item ID:<input type="text" name="search_id">
<input type="radio" id="search_types" name="search_types" value="1" checked="checked" />{$lng.lbl_sku}
<input type="radio" id="search_types" name="search_types" value="2" />PID
<input type="submit" value="find">
</form>
{/if}


scoobie 11-18-2007 01:50 AM

Re: Direct access to orders and items
 
Hi,

I've implemented this mod with little hiccup... the order bit works but not the product bit. When I enter in my sku, my url gets translated to:-
https://www.womansworld.com.au/dev/xcart/admin/product_modify.php?search_id=D1429&search_types=1

I can see the url is wrong and the word admin should be the word provider. My code in include/product_modify.php is this:-

ini_set("memory_limit", "32M");

function get_productid($product_code) {
$category_query = db_query("SELECT productid FROM xcart_products WHERE productcode = '" . (int)$product_code . "'");
$category = mysql_fetch_array($category_query, MYSQL_ASSOC);

return $category['productid'];
}
if ($HTTP_POST_VARS['search_types'] == 1){
?>
<script type="text/javascript" language="JavaScript"><!--
setTimeout('Redirect()',500);
function Redirect()
{
location.href = '../provider/product_modify.php?productid=<?PHP echo get_productid($HTTP_POST_VARS['search_id']) ?>';
}
// --></script>
<?PHP
}elseif ($HTTP_POST_VARS['search_types'] == 2){
?>
<script type="text/javascript" language="JavaScript"><!--
setTimeout('Redirect()',500);
function Redirect()
{
location.href = '../provider/product_modify.php?productid=<?PHP echo $HTTP_POST_VARS['search_id'] ?>';
}
// --></script>
<?PHP
}

The code in my admin_head.tpl for the order bit is:-
{if $login ne ''}
<form action="product_modify.php"> Item ID:<input type="text" name="search_id"><input type="submit" value="find">
<input type="radio" id="search_types" name="search_types" value="1" checked="checked" />{$lng.lbl_sku}
<input type="radio" id="search_types" name="search_types" value="2" />PID
</form>
{/if}

I am not sure why I am getting a different url and how to fix it?

scoobie 11-21-2007 02:14 AM

Re: Direct access to orders and items
 
Hi,

I finally got my code to work. :D I had <input type="submit" value="find"> in the wrong spot in head_admin.tpl. However if anyone is interested, I had to remove the reference to (int) in the product_modify.php file. For me it was not appending the productid to the url so it couldn't find the product. My php select statement looks like this now:-

$category_query = db_query("SELECT productid FROM xcart_products WHERE productcode = '" . $product_code . "'");

mgatten 11-27-2007 11:19 AM

Re: Direct access to orders and items
 
1 Attachment(s)
This is a great little mod!

I liked the idea of having it in the header area, but my search needs are a little different so I made some changes. Firstly, I would never use it for searching for a product, so I didn't need that part. I just need to search orders frequently. Sometimes I have an order number, but sometimes I only have a name and vague idea of time, or just a name with no idea of time.

So mine now sits in the header with a field for order number, a field for name, and radio buttons for time periods. There's no submit button since you can just hit enter.

I should also mention that I never use the language selector that appears in that area of the header, so I actually replaced it with the order search. If you use the language selector, be aware that this will make it go away.

I don't know how some people are making images appear in their posts, since the img tag doesn't seem to do it, but here's a link to a snapshot:
http://forum.x-cart.com/attachment.php?attachmentid=659&stc=1&d=1196193934 Snap1.jpg

To do this, I edited skin1/head_admin.tpl. Find the following snippet. If you haven't already modified the file you should find it at lines 15-37, but just be sure you are looking at the whole table row (the <tr> before the '{if' all the way through to the </tr> that comes after the {else}):
Code:

<tr>
        <td colspan="2" class="HeadLine" align="right" height="22">
{if ($usertype eq "P" or $usertype eq "A") and $login and $all_languages_cnt gt 1}
<form action="{$smarty.server.REQUEST_URI|amp}" method="post" name="asl_form">
<table cellpadding="0" cellspacing="0">
<tr>
        <td><b>{$lng.lbl_current_language}:</b>&nbsp;</td>
        <td>
<input type="hidden" name="redirect" value="{$smarty.server.QUERY_STRING|amp}" />
<select name="asl" onchange="javascript: document.asl_form.submit()">
{section name=ai loop=$all_languages}
<option value="{$all_languages[ai].code}"{if $current_language eq $all_languages[ai].code} selected="selected"{/if}>{$all_languages[ai].language}</option>
{/section}
</select>
        </td>
</tr>
</table>
</form>
{else}
&nbsp;
{/if}
</td>
</tr>


Replace that entire snippet with this one: (After backing up the original, of course)
Code:

<tr>
  <td colspan="2" class="HeadLine" align="right" height="22">
      {if ($usertype eq "P" or $usertype eq "A") and $login}
          <table>
              <tr>
                  <td>
                    <form name="searchform" action="order.php" method="post">
                        <table>
                            <tr>
                                <td>Order Number:</td>
                                <td><input name="orderid" type="text" size="10" maxlength="8"></td>
                            </tr>
                        </table>
                    </form>
                  </td>
                  <td>
                    <form name="searchform" action="orders.php" method="post">
                        <table>
                            <tr>
                                <td>Name:</td>
                                <td><input name="posted_data[customer]" type="text" size="10" maxlength="35"></td>
                                <td><input name="posted_data[date_period]" value="" checked="checked" type="radio"></td>
                                <td width="60">All dates</td>
                                <td><input name="posted_data[date_period]" value="M" type="radio"></td>
                                <td width="80">This month</td>
                                <td><input name="posted_data[date_period]" value="W" type="radio"></td>
                                <td width="80">This week</td>
                                <td><input name="posted_data[date_period]" value="D" type="radio"></td>
                                <td width="60">Today</td>
                                <td width="1"><input type="hidden" id="orderid2" name="orderid2" value=""><input type="hidden" name="posted_data[by_username]" value="on"><input type="hidden" name="posted_data[by_firstname]" value="on"><input type="hidden" name="posted_data[by_lastname]" value="on"><input type="hidden" name="posted_data[address_type]" value="Both">&nbsp;</td>
                            </tr>
                        </table>
                    </form>
                  </td>
              </tr>
          </table>
      {else}
          &nbsp;
      {/if}
  </td>
</tr>

I hope somebody finds this useful!!

(By the way, I did this in version 4.1.9. Your mileage may vary in other versions.)

Marshall

Vacman 12-02-2007 04:31 PM

Re: Direct access to orders and items
 
Marshall - works great! Thanks!

weckie 12-04-2007 03:21 PM

Re: Direct access to orders and items
 
The same one can do with USERS.
Just put this line in.

<form action="user_modify.php">
User: <input type="text" name="user"> <input type="hidden" name="usertype" value="C"> <input type="submit" value="&nbsp;Find&nbsp;">
</form>

:) Regards.

mgatten 12-14-2007 10:39 AM

Re: Direct access to orders and items
 
I've noticed that the first time I do a search by order number it often tells me that I don't have access to that area, but doesn't log me out. Just re-doing the exact same search then works fine. Has anybody else seen this? Anybody have any idea what might be causing it?

Marshall

Looker1 12-14-2007 11:20 PM

Re: Direct access to orders and items
 
worked perfectly for me- thanks for such a necessary mod!

HWT 12-15-2007 09:04 AM

Re: Direct access to orders and items
 
Quote:

Originally Posted by mgatten
I've noticed that the first time I do a search by order number it often tells me that I don't have access to that area, but doesn't log me out. Just re-doing the exact same search then works fine. Has anybody else seen this? Anybody have any idea what might be causing it?

Marshall


Yes, a space. Make sure there are no spaces before or after your order id #. Happens to me all the time when I'm searching orders to put in tracking #'s. Every time I think Oh @#$%@#$!!!!, and waste another few seconds. I've gotten much better at selecting when I copy/paste.

Vacman 01-05-2008 10:53 PM

Re: Direct access to orders and items
 
Still would love to be able to search by the customers tracking number as well....

wayneherndon 05-21-2008 07:53 PM

Re: Direct access to orders and items
 
Anyone know how to set this up to direct access to a product using an Extra Field (manufacturer model number in my case).

WH

tnpaintballers 05-22-2008 07:47 AM

Re: Direct access to orders and items
 
Quote:

Originally Posted by wayneherndon
Anyone know how to set this up to direct access to a product using an Extra Field (manufacturer model number in my case).

WH


I wont have time to try & work on this until this weekend. I think this will be harder to make because this is a dynamic field. I am sure I will have to hard code the Extra Field index key or something. I will post sometime on Sunday when I have something.

JWait 05-23-2008 04:36 PM

Re: Direct access to orders and items
 
Sweet mod! It was so simple to do that I took the 5 minutes to install in in the working site that we are planning to upgrade soon. So I can vouch it works in 4.0.19 and 4.1.8. Both times I just followed the instructions in post #21.


All times are GMT -8. The time now is 06:04 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.