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 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 . "'");


All times are GMT -8. The time now is 01:26 PM.

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