View Single Post
  #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