![]() |
Show only items in stock button
Howdy,
Based on feedback on our store I made this quick and simple mod to enable people to view only items in stock. http://www.pchealth.ie to see it in action (this is a live store) This is how I did it in X-Cart 4.0.18: In include/search.php below Code:
if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); } add Code:
# To enable showing only products in stock. http://forum.x-cart.com/viewtopic.php?p=149643#149643 locate Code:
$smarty->assign("navigation_script","search.php?mode=search"); Code:
$smarty->assign("navigation_script","search.php?mode=search&avail_only=$show_only_products_in_stock"); in /products.php add (last line before '?>') Code:
# Assign the "Show Only Products In Stock" locate Code:
$smarty->assign("navigation_script","home.php?cat=$cat&sort=$sort&sort_direction=$sort_direction"); Code:
$smarty->assign("navigation_script","home.php?cat=$cat&sort=$sort&sort_direction=$sort_direction&avail_only=$show_only_products_in_stock"); in /search.php add (last line before 'func_display("customer/home.tpl",$smarty);') Code:
# Assign the "Show Only Products In Stock" create a file /skin1/customer/main/show_instock.tpl and add Code:
Show: in /skin1/customer/main/subcategories.tpl /skin1/customer/main/search_result.tpl (if you have the Manufacturers modules activated also /skin1/modules/Manufacturers/customer_manufacturer_products.tpl) add Code:
{include file="customer/customized/show_instock.tpl" Code:
{include file="main/search_sort_by.tpl" sort_fields=$sort_fields selected=$search_prefilled.sort_field direction=$search_prefilled.sort_direction url="###home.php or search.php####&"} if you have the Manufacturers module activated also do this: in /modules/Manufacturers/customer_manufacturers_list.php locate Code:
$smarty->assign("navigation_script","manufacturers.php?manufacturerid=".$manufacturerid."&sort=".$sort."&sort_direction=".$sort_direction); Code:
$smarty->assign("navigation_script","manufacturers.php?manufacturerid=".$manufacturerid."&sort=".$sort."&sort_direction=".$sort_direction."&avail_only=".$show_only_products_in_stock); Code:
# Assign the "Show Only Products In Stock" And that should be about it... I know this isn't the best of recipes, but I hope someone might find it useful, at least for inspiration. Hasse |
All times are GMT -8. The time now is 02:17 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.