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.