Allow "shipable product" default settings to be changed to unchecked for product and product classes
GregoryHeller - August 13, 2009 - 21:39
| Project: | Ubercart |
| Version: | 6.x-2.0-rc6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
It seems that all product nodes are by default "shipable" and this includes all product class nodes. This seems to cater to a specific kind of ecommerce store: one that sells shipable products. The result is that a store the primarily sells things that are not shipable: file downloads, electronic access to content, user roles, tickets or registrations to events/classes always have to UNCHECK the "shipable product" check box when creating a node. (unless i am missing something).
Under the "product settings" screen, the default for product type: shipable/not shipable should be able to be set. same goes for product classes. and entire class should be able to be configured as not shipable.

#1
I really need this feature too.
#2
I have attached a patch to uc_product for 6.x-2.0-rc6 -- If needed for rc3, I would have to look at the differences from rc3 to rc6. I hate to patch backwards. However, I did check that it will work on the latest dev as of this post.
This patch adds a checkbox option to the content type form of all product types under the "Ubercart product settings" fieldset. This is the best place since it can cover 'product' as well as all added product classes. The shipping option can still be overridden at product level if needed.
Applying patch:
apply patch from modules/ubercart
#3
Yeah, this is good. Committed with the following change: added a query to uc_product_uninstall() to delete all of the variables that could be created by this feature. If we wanted to be really slick, we should delete the settings whenever a product class is deleted (or uc_product_kit is uninstalled). I just don't think it's worth the time to take to make it happen, yet.
#4
thanks for the updated patch. I forgot the .install. Is there a reason why all variables aren't dumped with "uc_product_%%"?
For the variable clean up on node type change and delete, below is a function that I have used on some custom modules and works great. I adapted it from the fivestar module's hook_node_type.
<?php
/**
* Implementation of hook_node_type().
*/
function uc_product_node_type($op, $info) {
$type = $info->type;
$variables = array('uc_product_shippable');
if ($op == 'delete') {
// cleanup unneeded variables.
foreach ($variables as $variable) {
variable_del($variable .'_'. $type);
}
}
elseif ($op == 'update' && !empty($info->old_type) && $info->old_type != $type) {
// when changing the type name, update the variables.
foreach ($variables as $variable) {
$value = variable_get($variable .'_'. $info->old_type, -1);
if ($value != -1) {
variable_del($variable .'_'. $info->old_type);
variable_set($variable .'_'. $type, $value);
}
}
}
}
?>
#5
Automatically closed -- issue fixed for 2 weeks with no activity.