Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how do i stop people from buying the same unique item?


arc

Recommended Posts

Posted

hi everyone,

 

items that i am looking to sell are unique. each piece is different so stock is always 1.

 

i played with the configuration but the only thing it did for me was say it's "out of stock/not available" if i add more than 1 quanity of that product.

 

so i added two products. had a friend add the same two products and he checked out. i then proceeded to checkout and it went thro! so that means both of us ordered the same item but that's not possible b/c each item is unique.

 

Any ideas?

 

Thanks in advance!

 

Johnny

Posted

couldn't find an edit button..

 

but it would be even better if someone added a product to their basket that it would disable the "add to cart" for anyone else.

 

thanks!

Posted

hi Salvo,

 

the problem is that if someone adds it to their basket, that doesnt' change the stock so i can't use the if,else statement right?

 

=)

Posted

You could update the db, substract the stock and make sure the order button doesn't show when stock is insufficient. The problem with this is that after someone abandons his cart you are stuck with insufficient stock while in real life you do have the stock. So the correct solution would be to make the substraction session based, if the session is expired you add the stock back again. Will be pretty complicated...

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Posted

Hmm having this problem myself,

 

I think if you got to admin, then stcok then you can turn off "allow chkout"

 

Just going to test if that works, think it should stop people ordering items out of stock

Posted

That will only work if the order has gone through, not if the item is still in the cart of the customers. The problem is he wants to avoid the article shows on the site if the customer has placed it in his cart (if I am understanding it correctly?)

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Posted

hi guys,

 

while i would prefer what mattice suggested (about the session thing) that sounds waaay too complicated for me to figure out.

 

i would be happy if this could happen..

 

two people add the same product to their basket. customerA checks out first and completes the transaction. customerB checks out but somewhere along the process, he gets the notice of "not available or not in stock" (i see this option is available on the basket page if someone orders more than what's in stock).

 

i would've assumed that when customerA checks out, it would make the stock of that product 0, so customerB would not be able to checkout.

 

hope that makes sense! =)

 

Johnny

Posted

jkfoo,

 

please let me know what you find out. i believe i have it set so that it does not allow a customer to checkout but it doesnt seem to be working.

  • 4 weeks later...
Posted

I have the same problem, but with a twist.

 

I'm using the Shoppe Enhancement Controller 1.0b with CVS 5-18-03.

 

When I add an item to my cart, it shows the cart (good). When I click on the item to view its info again, the Add to Cart button is still there. When I click on it, it takes me back to the cart but increments the quantity. Since it's a 1-only item, you get the error message to edit the number as there's insufficient stock.

 

Is there an easy way to either change the way the Add to Cart function works (to only allow 1 item of 1-off items) or is this something i'm going to have to code myself?

 

Thanks!

 

-al

  • 2 weeks later...
Posted

Halbert,

I am in the same boat. SEC 1.0b and CVS 5-18-03. This is how I did it. It seems to be working fine now.

 

modify:

catalog/product_info.php

 

was

        <td align="right" class="main">

         <?php echo ( (SHOW_IN_CART_QTY_PRODUCT_INFO and ($cart->in_cart($products_id) or $cart->in_cart($HTTP_GET_VARS['products_id']))) ? PRODUCTS_ORDER_QTY_TEXT_IN_CART . ' ' . $cart->get_quantity($products_id) . '<br>' : ''); ?>

         <?php echo PRODUCTS_ORDER_QTY_TEXT; ?> <input type="text" name="cart_quantity" value=<?php echo (tep_get_buy_now_qty((int)$HTTP_GET_VARS['products_id'])); ?> maxlength="5" size="3"><?php echo ((tep_get_products_quantity_order_min((int)$HTTP_GET_VARS['products_id'])) > 1 ? PRODUCTS_ORDER_QTY_MIN_TEXT . (tep_get_products_quantity_order_min((int)$HTTP_GET_VARS['products_id'])) : ""); ?><?php echo (tep_get_products_quantity_order_units((int)$HTTP_GET_VARS['products_id']) > 1 ? PRODUCTS_ORDER_QTY_UNIT_TEXT . (tep_get_products_quantity_order_units((int)$HTTP_GET_VARS['products_id'])) : ""); ?>

       </td>

     </tr>

     <tr>

       <td align="right" class="main"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

     </tr>

change to

        <td align="right" class="main">

         <?php echo ( (SHOW_IN_CART_QTY_PRODUCT_INFO and ($cart->in_cart($products_id) or $cart->in_cart($HTTP_GET_VARS['products_id']))) ? PRODUCTS_ORDER_QTY_TEXT_IN_CART . ' ' . $cart->get_quantity($products_id) . '<br>' : ''); ?>

         <?php echo PRODUCTS_ORDER_QTY_TEXT; ?> <input type="hidden" name="cart_quantity" value="1" size="1"><?php echo ((tep_get_products_quantity_order_min((int)$HTTP_GET_VARS['products_id'])) > 1 ? PRODUCTS_ORDER_QTY_MIN_TEXT . (tep_get_products_quantity_order_min((int)$HTTP_GET_VARS['products_id'])) : ""); ?><?php echo (tep_get_products_quantity_order_units((int)$HTTP_GET_VARS['products_id']) > 1 ? PRODUCTS_ORDER_QTY_UNIT_TEXT . (tep_get_products_quantity_order_units((int)$HTTP_GET_VARS['products_id'])) : ""); ?>

       </td>

     </tr>

     <tr>

       <td align="right" class="main">

       <?php

          if ($cart->get_quantity($products_id) < 1) {

          echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

          } else {

          ?>

          <b>This item is already in your cart.</b>

          <?php

          }

          ?>

          </td>

     </tr>

 

 

catalog/includes/modules/order_details.php

was

  echo '    <td align="center" class="tableHeading">' . TABLE_HEADING_QUANTITY . '</td>' . "n";

change to

/* don't display quantity=  echo '    <td align="center" class="tableHeading">' . TABLE_HEADING_QUANTITY . '</td>' . "n";*/

 echo '    <td align="center" class="tableHeading"> </td>' . "n";

 

catalog/includes/languages/english/shoppe_enhancement_controller_languages.php

was

define('PRODUCTS_ORDER_QTY_TEXT','Add Qty to Cart: ');

change to

define('PRODUCTS_ORDER_QTY_TEXT',''); //default=Add Qty to Cart:

 

catalog/includes/modules/product_listing_multi_add_all.php

was

    $lc_text = TEXT_OPTIONS;

   $lc_align = 'center';

   $list_box_contents[$cur_row][] = array('align' => $lc_align,

                                           'params' => 'class="productListing-heading"',

                                           'text'  => $lc_text);

change to

    $lc_text = TEXT_OPTIONS;

   $lc_align = 'center';

   $list_box_contents[$cur_row][] = array('align' => $lc_align,

                                           'params' => 'class="productListing-heading"',

                                           'text'  => ' ');//was set to $lc_text

 

catalog/includes/modules/product_listing_multi_add.php

was

              default:

               $lc_align = 'right';

               $how_many_buy_now++;

             if ($cart->get_quantity($listing['products_id']) > 0) {

               $lc_text = PRODUCTS_QUANTITY_IN_CART_LISTING . ' ' . $cart->get_quantity($listing['products_id'])  . '<br>' . PRODUCTS_QUANTITY_ADD_ADDITIONAL_LISTING . '<br>' . ' <input type="text" name="Qty_ProdId_' . $listing['products_id'] . '" value="0" maxlength="6" size="3">' . '<br>' . $lc_qty_min_units;

             } else {

               $lc_text = ' <input type="text" name="Qty_ProdId_' . $listing['products_id'] . '" value="0" maxlength="6" size="3">' . '<br>' . $lc_qty_min_units;

             }

             break;

change to

              default:

               $lc_align = 'right';

               $how_many_buy_now++;

               if (STOCK_ALLOW_CHECKOUT=='false' and tep_get_products_stock($listing['products_id']) < 1) {

               $lc_text =(SOLD_OUT_IMAGE_ON=='1' ? tep_image(DIR_WS_IMAGES . SOLD_OUT_IMAGE, '', '', SOLD_OUT_TEXT) : SOLD_OUT_TEXT);

               } else if ($cart->get_quantity($listing['products_id']) > 0) {

/* original code=              if ($cart->get_quantity($listing['products_id']) > 0) {

               $lc_text = PRODUCTS_QUANTITY_IN_CART_LISTING . ' ' . $cart->get_quantity($listing['products_id'])  . '<br>' . PRODUCTS_QUANTITY_ADD_ADDITIONAL_LISTING . '<br>' . ' <input type="hidden" name="Qty_ProdId_' . $listing['products_id'] . '" value="0" maxlength="6" size="3">' . '<br>' . $lc_qty_min_units;*/

               $lc_text = 'This item is<br>already in your cart';

             } else {

               $lc_text = ' <input type="checkbox" name="Qty_ProdId_' . $listing['products_id'] . '" value="1" maxlength="6" size="3">' . '<br>' . $lc_qty_min_units;

             }

             break;

 

Basically I made any user input either a checkbox or hidden and put a notification that the item was either sold or in their cart already.

 

It's all new to me but it works.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...