Zen Cart Logo
Forums / Basic Configuration / Limit Products in Store

Limit Products in Store

Locked

Views: 1,107

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
23 Sep 2009, 11:33 PM
#1
netgirlz avatar

netgirlz

New Zenner

Join Date:
Aug 2009
Posts:
34
Plugin Contributions:
0

Limit Products in Store

Hi

I am looking at limiting the number of products a store owner can have in his store.

the basic package would be 100 products if he wants more then he would need to upgrade to the next package

this was asked some time back ( http://www.zen-cart.com/forum/showthread.php?t=100031 ) but next got an answer

hoping someone has a solution

24 Sep 2009, 12:23 AM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Limit Products in Store

What was asked for in that other thread would be a very clear breach of the GPL license under which Zen Cart is distributed, and contrary to the spirit of open source within which Zen Cart is developed.

24 Sep 2009, 1:49 AM
#3
netgirlz avatar

netgirlz

New Zenner

Join Date:
Aug 2009
Posts:
34
Plugin Contributions:
0

Re: Limit Products in Store

Thanks for response

So what do web designers/developers do when they want to limit the number of products a store owner has in their store and want to have a package with 0-100 products 0-1000 products and 1000 products +

a greater number of products = more storage and potentially more traffic.

please excuse our ignorance

thanks in advance

6 Oct 2009, 9:35 AM
#4
netgirlz avatar

netgirlz

New Zenner

Join Date:
Aug 2009
Posts:
34
Plugin Contributions:
0

Re: Limit Products in Store

hi found a solution and for education purposes the following info is provided

modify products.php by adding the function (number of products in store is limited to 100)

function products_allowed(){

global $db;
global $product_limit;
$product_limit = 100;

  $products = $db->Execute("select count(*) as count from " . TABLE_PRODUCTS . " where products_status = '1'");
  if ($products->fields['count'] >= $product_limit){return 'true';}
return 'false';
}

add the following case statments

     case 'new_product':
if (products_allowed() == 'true') header("location: product_limit_denied.php");
      break;

      case 'insert_product':
if (products_allowed() == 'true') header("location: product_limit_denied.php");
	break;

then use the file denied.php from admin profiles module , in this example I renamed the file to product_limit_denied.php

this is for educational purposes and is not supported or guaranteed to work.