9 replies [Last post]
xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
Was this information Helpful?

If a store is selling both shippable and non-shippable products, it would be nice to be able to disable the delivery information pane during checkout, if there are no shippable products in the cart. Is that easy to do already? Or does it seem like a good idea to make that the default behavior?

Best,
Xerxes

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
It already works. You can

It already works. Smiling You can check the checkout settings to make sure you have this option turned on, and the latest dev version allows you to set a product as non-shippable. (Some product features will also let you specify products as non-shippable.)

xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
Re: It already works. You can

Of course, you're always one step ahead Smiling

There must be something wrong with my setup then... I create a new product, uncheck "Product and its derivatives are shippable" and check "Hide shipping information when possible for carts with no shippable items" in the checkout settings. When I go to checkout with this item, the delivery information and shipping quote panes are still there.

I'm using bazaar version 501.

Any ideas?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: It already works. You can

Well... how about that. Sticking out tongue It's also not functioning on the Livetest. I'll have to look into it when I get a chance.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: It already works. You can

For some reason or another this is working again. I'd check out the latest Bazaar and let me know if that fixes the problem.

xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
Re: Re: Re: Re: It already works. You can

Hmmm... just checked out out the latest Bazaar, but no luck here. I'll let you know if I figure it out...

xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
Hi Ryan, I finally tracked

Hi Ryan,

I finally tracked this issue down a little further (I just checked out alpha 8 / bzr and am still having this issue).

On line 1969 of uc_cart module I see this code:

if ($product->data['shippable'] === FALSE) {
return FALSE;
}

My $product->data['shippable'] is a string = 0, which I suppose is not identical to FALSE...

If I change it to == like this:

if ($product->data['shippable'] == FALSE) {

everything works as it should.

I'm not sure why it's working on your livetest but not on my site...so...is this a bug that should be fixed or is there something wrong with my site?

Thanks.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Hi Ryan, I finally tracked

Trying to remember why I used === instead of ==. I think it may have had something to do with update purposes so that when someone updated to the latest version it wouldn't make all their existing products non-shippable since they'd have NULL values (NULL == FALSE evaluates to TRUE but NULL === FALSE evaluates to FALSE).

I'm curious if you've updated from a previous version or if this is a clean install.

xerbutter's picture
Offline
Bug Finder
Joined: 09/07/2007
Juice: 146
Re: Re: Hi Ryan, I finally tracked

I updated from a previous version.

In any case, it looks like the database update script should take care of making sure that existing products are not null and default to shippable: (from uc_product.install)

// Update to add the shippable column to the product table.
function uc_product_update_10() {
$ret = array();
switch ($GLOBALS['db_type']){
case 'mysql':
case 'mysqli':
$ret[] = update_sql("ALTER TABLE {uc_products} ADD shippable tinyint(2) NOT NULL default 1");
break;
case 'pgsql':
db_add_column($ret, 'uc_products', 'shippable', 'tinyint', array('not null' => true, 'default' => 1));
break;
}
return $ret;
}

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Hi Ryan, I finally tracked

Huh... didn't realize I'd had that much forethought. Sticking out tongue Well, I'll switch it and do some testing on the Livetest later today.