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

Listing all out of stocks

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-10-2006, 03:02 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default Listing all out of stocks

I don't know if this is of any use to anyone, but here it is.

This works on my version of xcart - 3.5.10, but I make no guarantees that it will work on yours, or that it is safe to use.

All it does is read data and display it, but use at you own risk.

Create a new file called nostock.tpl within your skin1/provider/ folder containing the following:

Code:
{capture name=dialog} <table border=0> <TR> <TD height="10">Product Number</TD> <TD height="10">Product Name</TD> </TR> {section name=productlisting loop=$productlisting} <TR> <TD height="10">{$productlisting[productlisting].productid}</TD> <TD height="10">{$productlisting[productlisting].product}</TD> </TR> {/section} </table> {/capture} {include file="dialog.tpl" title="Products With Zero Stock" content=$smarty.capture.dialog extra="width=100%"}

Create a new file called nostock.php within yur provider/ folder containing the following:
Code:
<?php # # $Id: nostock.php,v 0.1 2006/1/10 12:25:55 AH # require "./auth.php"; require $xcart_dir."/include/security.php"; $productlisting = func_query("SELECT xcart_products.productid, xcart_products.product FROM xcart_products WHERE xcart_products.avail=0 AND xcart_products.forsale='Y' ORDER BY xcart_products.add_date DESC"); $smarty->assign("productlisting",$productlisting); $smarty->assign("main","nostock"); @include $xcart_dir."/modules/gold_display.php"; $smarty->display("provider/nostock.tpl"); ?>

Add the following to your common_templates file:

Code:
{elseif $main eq "nostock"} {include file="provider/nostock.tpl"}

Add the following code to your /skin1/provider/menu.tpl file:


[/code]

This adds a 'products with zero stock' option to your products menu.

hth

Note: I would like to add a qty column so you can quickly update xcart_products.avail but I am not sure how to implement the update yet. I can read the data and display it, but adding the update button is a bit more complicated and i don't have the time to do it yet.

I would also like to add an available/disabled option to disable discontinued products.

If anyone knows how to modify the files, please post here. Many Thanks,
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #2  
Old 03-23-2006, 02:21 AM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,509
 

Default

I've updated this with a checkbox next to each item and a disable button at the bottom. If you tick the tick boxes and click the button it will set the prod_avail to N making the product disabled.

I was going to use a similar system to update the quantities as i thought it would be useful then a delivery came in, but I have the back in stock notification mod which i would need to tie in, so I haven't done this, although there is a textbox in the template ready for this when i get round to it, might might be never as i'm probably going to upgrade to 4.0.18.

I did this a while ago so i thought i would post the update here as I do find it handy to go through and disable products that are out of stock and will not be re-ordered.

nostock.tpl:

Code:
{capture name=dialog} <form action="nostock.php" method="post"> <table border=0> <TR> <TD height="10">Supplier</TD> <TD height="10">Product Number</TD> <TD height="10">Product Name</TD> <TD height="10">Quantity</TD> <TD height="10">Disable</TD> </TR> {section name=productlisting loop=$productlisting} <TR> <TD height="10">{$productlisting[productlisting].param03}</TD> <TD height="10">{$productlisting[productlisting].productid}</TD> <TD height="10">{$productlisting[productlisting].product}</TD> <TD height="10"><INPUT TYPE=TEXT NAME="qty"></TD> <TD height="10"><INPUT TYPE=CHECKBOX value="{$productlisting[productlisting].productid}" NAME="disablearray[]"></TD> </TR> {/section} <TR> <TD height="10"></TD> <TD height="10"></TD> <TD height="10"></TD> <TD height="10"></TD> <TD height="10"><INPUT TYPE=submit name="disable" value="disable"></TD> </TR> </table> </form> {/capture} {include file="dialog.tpl" title="Products With Zero Stock" content=$smarty.capture.dialog extra="width=100%"}

nostock.php:

Code:
<?php # # $Id: nostock.php,v 0.1 2006/1/10 12:25:55 AH # require "./auth.php"; require $xcart_dir."/include/security.php"; if (is_array($disablearray)) { foreach ($disablearray as $prod) { db_query("UPDATE xcart_products SET forsale='N' WHERE productid='$prod'"); } } $productlisting = func_query("SELECT xcart_products.productid, xcart_products.param03, xcart_products.product FROM xcart_products WHERE xcart_products.avail=0 AND xcart_products.forsale='Y' ORDER BY xcart_products.add_date DESC"); $smarty->assign("productlisting",$productlisting); $smarty->assign("main","nostock"); @include $xcart_dir."/modules/gold_display.php"; $smarty->display("provider/nostock.tpl"); ?>
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
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 01:33 AM.

   

 
X-Cart forums © 2001-2020