Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Direct access to orders and items

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 12-07-2006, 04:23 PM
 
Audiolines Audiolines is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 102
 

Default 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.
__________________
version 4.0.17
Reply With Quote
  #12  
Old 12-13-2006, 10:10 AM
  girlsbits's Avatar 
girlsbits girlsbits is offline
 

Advanced Member
  
Join Date: May 2006
Posts: 77
 

Default 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>
__________________
X-Cart Gold | v 4.0.18 | Unix | php 4.3 | phpMyAdmin 2.8.0.3 |
Reply With Quote
  #13  
Old 08-20-2007, 03:26 PM
  Vacman's Avatar 
Vacman Vacman is offline
 

X-Adept
  
Join Date: Sep 2005
Location: Torrance, CA
Posts: 792
 

Default Re: Direct access to orders and items

And you can put the code into admin/menu_admin.tpl for 4.1.x users.
__________________
Carl Tice

X-Cart 4.6.6
X-Payments 3.0
ReBOOT 3.4.1

PHP 5.6.30
MySQL 5.6.35
Linux 2.6.32-042stab120.18
ionCube PHP Loader v4.7.3
Perl 5.10.1
Reply With Quote
  #14  
Old 08-22-2007, 05:10 AM
 
Andrew Gadsden Andrew Gadsden is offline
 

Member
  
Join Date: Aug 2006
Location: Portsmouth, UK
Posts: 20
 

Default Re: Direct access to orders and items

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")

Click image for larger version

Name:	quickfind_screenshot.jpg
Views:	355
Size:	16.5 KB
ID:	534

Thanks Audioline.
__________________
Andrew Gadsden
xcart 4.1.8 [unix]

http://www.allabouttea.co.uk

The home of Tea on the Web - forum members please use code XCART-77 for a 10% discount!
Reply With Quote
  #15  
Old 10-25-2007, 08:41 AM
 
tnpaintballers tnpaintballers is offline
 

Member
  
Join Date: Sep 2007
Posts: 28
 

Default 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
__________________
Version 4.1.8

TN Paintballers LLC
914 N Charles G Seivers Blvd
Clinton, TN 37716
865-457-8000
www.tnpaintballers.com
Reply With Quote
  #16  
Old 10-25-2007, 01:25 PM
 
tnpaintballers tnpaintballers is offline
 

Member
  
Join Date: Sep 2007
Posts: 28
 

Default 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
__________________
Version 4.1.8

TN Paintballers LLC
914 N Charles G Seivers Blvd
Clinton, TN 37716
865-457-8000
www.tnpaintballers.com
Reply With Quote
  #17  
Old 10-26-2007, 06:28 AM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,470
 

Default Re: Direct access to orders and items

Sweet ... Nice addition ..
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
Reply With Quote
  #18  
Old 10-26-2007, 12:43 PM
 
tnpaintballers tnpaintballers is offline
 

Member
  
Join Date: Sep 2007
Posts: 28
 

Default 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}
__________________
Version 4.1.8

TN Paintballers LLC
914 N Charles G Seivers Blvd
Clinton, TN 37716
865-457-8000
www.tnpaintballers.com
Reply With Quote
  #19  
Old 11-18-2007, 01:50 AM
  scoobie's Avatar 
scoobie scoobie is offline
 

Advanced Member
  
Join Date: Dec 2006
Location: Sydney
Posts: 84
 

Default 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?
__________________
X-CART 4.1.8 (Add-Ons: onSale, CDSEO, AOM, Thickbox)
PHP 4.4.4
SQL 4.1.21
Linux O/S
Reply With Quote
  #20  
Old 11-21-2007, 02:14 AM
  scoobie's Avatar 
scoobie scoobie is offline
 

Advanced Member
  
Join Date: Dec 2006
Location: Sydney
Posts: 84
 

Default Re: Direct access to orders and items

Hi,

I finally got my code to work. 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 . "'");
__________________
X-CART 4.1.8 (Add-Ons: onSale, CDSEO, AOM, Thickbox)
PHP 4.4.4
SQL 4.1.21
Linux O/S
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:16 PM.

   

 
X-Cart forums © 2001-2020