I'm setting up a store for a specialty food merchant. He can't ship wine; can products of one particular type be set to in-store pickup only? If not, can this be done on a per-product basis?
I'm setting up a store for a specialty food merchant. He can't ship wine; can products of one particular type be set to in-store pickup only? If not, can this be done on a per-product basis?
You can make an override on the shipping based on a given condition ...
For example, if you used a products_type 1 (Products General) for all products but products_type 4 (Document Product) for wine ...
You have a "built-in" flag of products_type to separte the 2 kinds of products which would tell you if:
wine only
other stuff only
wine and other stuff mixed
This can be checked with the shopping_cart class function in_cart_check ...
Then you can manage all shipping modules by controlling the:
$this->enabled
of each module based on a function that tests the cart to see what is really in the cart and when to override the normal enable of each Shipping Module ...
If you think this through ... it is not a difficult override to make, just a bit time consuming to write to get in all the code ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
NOTE: you do not have to use the products_type field to test this ...
You can add a new field, however, then you need additional coding for the Admin to manage the products table and the new setting ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Thanks for the info, this is very hlepful. A few basic questions...
How do apply the product type? Can it be applied to an entire category, being added to new products by default? Or do I apply it to each product? I didn't see a place in the product or category entry to do this - is this an attribute that needs to be set up?
Do I have to modify the shipping modules if I use the existing product type 4? Is there something I have to tell the product type about shipping?Originally Posted by Ajeh
thanks again for your help, Phil
Product Types are set while adding Products or Categories via the dropdown, just before you hit: New Product or New Category ...
The products_type = 4 is a handy one to use as it matches everything about the regular Products except it is using the document_products gang of files in the Catalog and Admin to manage these products ...
You could clone the document_products ... and I pick this one just because the variables and constants for it would be easy to follow ... and make a products_type such as products_wine or something similar ...
You'd then use this products_type which, more than likely, would become products_type 6 as your "flag" for wine and be able to control that product_type ...
Or, you can add on the products table a new field ... such as products_is_wine ... and follow one of the similar fields in the /admin to customize the code to allow for this new field ...
This can then be used for your test of what's in the cart ...
The "test" is running the function in_cart_check to see if there is one or more "wine" products in the cart ... if so, you can then customize the shipping modules to act according to the rules you need ... such as only show if no wine is in the cart, unless it is the Store Pickup ...
The Shipping modules each have a setting similar to this, taken from the item.php Shipping Module:
This is testing the cart for if the shipping should be free based on the function zen_get_shipping_enabled ...PHP Code:// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
}
What that does is test for various conditions for when shipping should be Free and only show the Free Shipping (freeshipper) Shipping Module and turn off or hide the other Shipping Modules ... even though you have them installed in the Admin ...
At the same time, if Shipping is not Free ... then it turns off or hides the Free Shipping (freeshipper) Shipping Module based on the opposit conditions so it will not show when the other Shipping Modules show ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
I'm still not quite getting this... are there detailed docs somewhere I'm missing? The wiki didn't explain how everything fits together. Maybe I can contribute something when I get this straight
First of all, I see where I can set a product type when I create a new product, but not when I create a new category (it would be useful to have all products of a certain category have a default type). I can't find a way to change the product type or add ont to a product once the product is created.
If I write a custom product type, or adapt an existing one, where does the code go? I grepped through the files for 'document_product' and didn't see a file that contained any logic I would expect to see.
The only flag with the product types is "allow add to cart" - I disabled it, and am still able to add products to the cart. How do I tell it the item is not shippable?
What I'm trying to do is tag certain products as available for instore pickup only. If a customer ordered a mix of products, some in-store and others not, is there a way to indicate at checkout that only part of the order could be shipped? Since they are coming in anyway, it might be better just to make the whole order unshippable. Could this be done some other way than product types, such as some sort of attribute?
Sorry to sound so dense on all this - I've used Zen Cart on other projects and like it a lot. I hope I'm not trying to push the envelope here.