Zen Cart Logo

Always "One" in Stock

Views: 1,167

Results 1 to 10 of 10
31 Dec 2010, 12:40 PM
#1
yellowaircraft avatar

yellowaircraft

New Zenner

Join Date:
Oct 2010
Posts:
31
Plugin Contributions:
0

Always "One" in Stock

Hi Guys,

I am having fun with Zen-Cart here. Thanks to all people who created it. My website is:
https://www.sariucak.com

I have a question. As you see I am selling stamps. All the stamps I am selling are "always" one item.
What this means is when a customer buys a stamp from the store. They can only buy one. So I won't bee needing "enter quantity" box in anywhere. I saw a couple of customers adding more than one in quantity, and naturally this action ends up with an alert in their shopping cart saying:
"Products marked with *** are out of stock.
Items not in stock will be placed on backorder."

This alert is a little misinforming. Customers think the item is not in stock.

When you change the quantity to "1" everything is just fine.

Is there any way to remove this "adding quantity" from products and shopping cart? or basically from everywhere?
This ways customers won't get confused...

Thanks in advance,
Cenk

31 Dec 2010, 1:04 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,068
Plugin Contributions:
56

Re: Always "One" in Stock

Assuming that each of your products is set up in your admin with "No, do not show quantity box", you could create the file /includes/extra_cart_actions/limit_to_one.php:

global $messageStack;

if (!defined(STOCK_LIMIT_TO_ONE)) {
  define('STOCK_LIMIT_TO_ONE', 'Sorry, your purchase is limited to one of each product.');
}

if ($_GET['action'] == 'buy_now' || $_GET['action'] == 'add_product') {
  $cart_qty = $_SESSION['cart']->in_cart_mixed($pID);
  if ($cart_qty > 0) {
    $messageStack->add_session('header', STOCK_LIMIT_TO_ONE, 'error');
    zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
  }
}

That will "intercept" any changes (other than delete requests) to the cart, check to see if the product is already in the cart and, if so, display a message to let the customer know what's going on and negate that update.

31 Dec 2010, 3:14 PM
#3
yellowaircraft avatar

yellowaircraft

New Zenner

Join Date:
Oct 2010
Posts:
31
Plugin Contributions:
0

Re: Always "One" in Stock

Thanks for the help...
Unfortunately My items haven't been setup as "No, do not show quantity box".
If there is no other easy way, I have to revise all the products to the one above and then create a new php file with the code you gave and copy/move the php file to the folder "/includes/extra_cart_actions"

Am I correct?

By the way my store's direct link is: http://www.sariucak.com/store/

The link in my first message is incomplete. Sorry about that.

Thanks
Cenk

31 Dec 2010, 3:40 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Always "One" in Stock

The text

Products marked with *** are out of stock.
Items not in stock will be placed on backorder.
Can be changed to something like
Products marked with *** are unique one of a kind items.
Only one is available for purchase.
Please revise your quantity to 1
You can also in the product setup screen try setting the "max" to 1

31 Dec 2010, 5:49 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,068
Plugin Contributions:
56

Re: Always "One" in Stock

yellowaircraft:

Thanks for the help...
Unfortunately My items haven't been setup as "No, do not show quantity box".
If there is no other easy way, I have to revise all the products to the one above and then create a new php file with the code you gave and copy/move the php file to the folder "/includes/extra_cart_actions"

Am I correct?

By the way my store's direct link is: http://www.sariucak.com/store/

The link in my first message is incomplete. Sorry about that.

Thanks
Cenk

What you've said is correct. If your products aren't set with "No, do not show quantity box", then a customer can (1) specify more than one of the product on the product_info page and (2) change the quantity from the shopping_cart page.

There's probably a SQL command lurking out there that can change the quantity-box setting on all products; I'll give it a look-see later today if you'd like.

31 Dec 2010, 7:12 PM
#6
yellowaircraft avatar

yellowaircraft

New Zenner

Join Date:
Oct 2010
Posts:
31
Plugin Contributions:
0

Re: Always "One" in Stock

Thanks lat9,
What you told is working for me now.

I am half way thru revising the products to "No, do not show quantity box".

While I was doing that. I tried something else. I added one item to my cart. Then I went back to the same item added it again.
When I go back to my shopping cart, item quantity shows "2". And the warning sign "Products marked with *** are out of stock.
Items not in stock will be placed on backorder." comes back again.

And as there is no "revisible" quantity box in the shopping cart anymore, customer has to delete the item and add it back.

As far as I read from the forum there is no way to prevent a customer to add same item twice into the shopping cart (or more than one customer adding same product at the same time) unless you write a custom code.

I feel like I am getting into details a little bit more than a regular zen-cart user but considering my customers' age (mostly 50 to 65) and computer knowledge I do not want them to find and fall into any cracks (by mistake of course) in the system.

Thanks again lat9,

Thanks to you too Kobra, I will try your suggestion too. It's a good idea that this warning should be specific to my needs.

Cheers
Cenk

31 Dec 2010, 7:15 PM
#7
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Always "One" in Stock

Try the "max" 1 setting also

31 Dec 2010, 8:56 PM
#8
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,068
Plugin Contributions:
56

Re: Always "One" in Stock

Kobra's right, of course, setting "No, do not show quantity box" AND Product Quantity Maximum to 1 should do the trick for you ...

31 Dec 2010, 9:21 PM
#9
yellowaircraft avatar

yellowaircraft

New Zenner

Join Date:
Oct 2010
Posts:
31
Plugin Contributions:
0

Re: Always "One" in Stock

You guys are great. :clap:

I am getting to the point I was looking for..

Setting "Product Qty Maximum:" to "1" as Kobra said, does not let customer add same product twice to their shopping cart.

Now I get a new warning:
"The quantity added to your cart has been adjusted because of a restriction on maximum you are allowed. See this item: Scott 14".

My last question (I hope ): How and/or where can I change these warnings?

Thanks
Cenk