Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Backorder/Preorder possible on SOME products?

Backorder/Preorder possible on SOME products?

Views: 2,787

Results 1 to 2 of 2
15 May 2013, 4:17 AM
#1
limitless avatar

limitless

Inactive

Join Date:
Jan 2012
Posts:
496
Plugin Contributions:
0

Backorder/Preorder possible on SOME products?

Is it possible to rework the sold out/add to cart functionality to allow products with a KNOWN availability to be pre-ordered?

Currently I have a good idea when hot products are going to be available and that ETA date is shown on the product info page.

By default, I don't allow check out of out of stock items.

I think that it would be possible to check the 'products_date_available' field and enable 'add to cart' if it meets certain conditions, ie less than 10 days out or something.

I did something similar to this by copying the 'freeshipping' icon display code, but use it to check for and display a 'Restricted Product' icon/link if the 'restricted_product' field (i created it) is not null.

<!--bof restricted product icon --> <?php if(zen_get_product_is_restricted($products_id_current)) { ?> <div id="restrictedProductIcon"><?php echo PRODUCT_RESTRICTED_TAG; ?> </div> <?php } ?> <!--eof restricted product icon -->

I think the logic would happen here (yes, I have back in stock notifications enabled):
Then I would need to add PRODUCT_BACKORDER_TAG data to the extra definitions.

I can get fancy with a 'backorder available' image, etc. but I need to enable the 'add to cart' option.

The quantity may or may not be '0', so I might need to override the default actions of BISN I think too, although it might not be too confusing to have both a pre-order/add to cart AND back in stock notifications available.

<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
  // do nothing
} else {
?>
            <?php
    $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
            if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
              // hide the quantity box and default to 1
              $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            } else {
              // show the quantity box
    $the_button = '<strong class="fleft toppad">'. PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '</strong>' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) .'<span class="ButtonRow">'. zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT).'</span>';
            }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
  ?>
  <?php if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      
      echo $display_qty;
      echo $display_button;

// BEGIN CEON BACK IN STOCK NOTIFICATIONS 1 of 2
if (!is_null($product_back_in_stock_notification_form_link)) {
  echo '<p>' . $product_back_in_stock_notification_form_link . '</p>';
}
// END CEON BACK IN STOCK NOTIFICATIONS 1 of 2
            ?>
          </div>
  <?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->

My php sucks and I am a hack when it comes to coding, but if anyone has some ideas to start me down a path, it would be appreciated.

15 May 2013, 4:42 AM
#2
limitless avatar

limitless

Inactive

Join Date:
Jan 2012
Posts:
496
Plugin Contributions:
0

Re: Backorder/Preorder possible on SOME products?

Thinking a little more on this, would it be possible to utilize a new 'product type' and accomplish this by dynamically changing the product type to 'Backorder/Preorder' and setting 'add to cart' to YES? Or would the global setting of do not allow checkout of Out of Stock Products override this functionality?

I currently receive product ETA's in csv format and run some custom SQL on the SKU's to update and maintain the 'products_available_date' on an hourly schedule. Perhaps adjusting the product type as i process the ETA's and periodically (nightly) run a job that sets any product with an ETA date that has passed to 'Product - General' again.

Just thinking out loud...