Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / prevent expected products from being added to cart

prevent expected products from being added to cart

Locked

Views: 2,065

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
27 Dec 2006, 9:04 PM
#1
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

prevent expected products from being added to cart

Hello folks;

I am a bit confused about the Date Expected product field.

When I set some future date here, the product still is able to be added to the cart.

I can set the quantity to zero, but the product is displayed as Sold Out.

At the bottom of the page is a nice box where my Expected Products show up, but I can't seem to find a way to allow my customer to simply browse these expected products without an option to buy them or showing the Sold Out message.

Maybe I do not understand the intended use of the Expected Date field. Can someone say?

Anyway, Showing the product as Sold Out before I even have it in stock may make the customer think incorrectly that all I am expecting have already been sold.

To summarize, I am seeking to confine my Expected products to the Expected Products display box and allow browsing, but not offer them for sale before I have them.

Thank you much;

Kiddo

PS: I am using Zen Cart 1.3.6 with no mods.

28 Dec 2006, 3:18 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: prevent expected products from being added to cart

At this time, the products_date_available field is a reference and not used to block purchases of products with stock ...

You would need to customize the code further to manage that for you ...

Currently, the 0 products_quantity will stop the product from being purchased ...

We will be looking into adding more control on the products_date_available in a future release ...

28 Dec 2006, 6:02 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: prevent expected products from being added to cart

You could customize the button function for the function zen_get_buy_now_button located in:
/includes/functions/functions_general.php

There is a select done on line 1129:

    $button_check = $db->Execute("select product_is_call, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");

Change that to:

    $button_check = $db->Execute("select product_is_call, products_quantity, products_date_available from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
    // upcoming date not available to purchase
    $upcoming_date_check = time();
    $upcoming_date_check = date('Ymd', $upcoming_date_check);
    $zc_current_date = (int)str_replace('-','',substr($button_check->fields['products_date_available'],0,10));

Just before the default case statement add:

    case ($zc_current_date > 0 && $zc_current_date >= $upcoming_date_check):
        $return_button = 'AVAILABLE: ' . zen_date_short($button_check->fields['products_date_available']);
        break;

NOTE: there is no override for this file so save both the original and your changes ...

28 Dec 2006, 6:17 PM
#4
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: prevent expected products from being added to cart

This is awesome Oba-san Ajeh !! Thank you !!!

I will fire up my editor and make this work.

This is not the first time you save me much confusion, I must buy you a cup of coffee today :)

Kiddo

28 Dec 2006, 6:28 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: prevent expected products from being added to cart

Coffee? I love coffee!! :smile:

Let us know how it works for you ... :cool:

28 Dec 2006, 6:48 PM
#6
kiddo avatar

kiddo

Totally Zenned

Join Date:
Jul 2006
Location:
SF Bay Area
Posts:
837
Plugin Contributions:
1

Re: prevent expected products from being added to cart

Ajeh:

Coffee? I love coffee!! :smile:

Let us know how it works for you ... :cool:

I recommend Jamaican Blue Mountain Special. I sent you enough to buy some.

Dear Kim XXXXXXXXX,

This email confirms that you have paid Zen Cart E-commerce ([email protected]) $50.00 USD using PayPal.



Payment Details

Transaction ID: 0BXXXXXXXXXXXXXXXXXXXX300
Item Price: $50.00 USD
Total: $50.00 USD
Item/Product Name: Zen Cart E-Commerce
Buyer: Kim XXXXXXXXXXX


Business Information

Business: Zen Cart E-commerce
Contact E-Mail: [email protected]

Enjoy;

Kiddo

28 Dec 2006, 6:59 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: prevent expected products from being added to cart

Thanks very much for your support ... I and the Zen Cart Team greatly appreciate it ...

I am very glad that this was able to help you out on your shop until we have had a chance to build up the functionality of the products_date_added to be more of a "working" field vs just a display field ...

Well ... off to get some coffee!! Thanks again!! :cool: