Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

Has anyone set up a 'by - category' type shipping plugin in exp:resso store?

I want to allow the client to use the category list to manage their own categories for products, but at the same time put in a flat rate for shipping per category.

For example, if a category falls under the category of books, the shipping is $4. If it is something small like seeds, shipping is $1, etc etc. If they pick one of each, the larger is taken as the final shipping price.

I am looking at the: per_item_rate, per_weight_rate fields in the store tables and I am thinking of adding a: per_category_rate table, but don't want to modify core stuff, only extending what is there for easy upgrades.

So taking the default shipping plugin - would it be best to start from this and build upon it, making change to the database fields and logic within it?

Or, would it be better to pull from a category group, and use a custom shipping field for the category, and roll your own plugin for shipping this way?

Any points in the right direction will ensure I don't go too far down one route when another is the best practice or more flexible way of going about it.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

There is nothing like this built in, so you would need to create a shipping plugin from scratch.

If you just need a one-off, and don't mind hard coding the values, you would be best to take a look at this simple example shipping plugin for Expresso Store.

If you want to create a redistributable plugin with a nice interface etc, take a look at the default shipping plugin (which is significantly more complex than any of the other shipping plugins). You probably want to avoid creating extra database tables etc, so you can store the settings for your plugin as an array (this will get automatically serialized/unserialized when your plugin is loaded).

If creating a reusable plugin, I would either create an interface to select categories and assign prices to them, or use a custom category field for the price, and provide a dropdown to select which custom field contains the shipping price.

Probably the most important thing to think about will be defining what happens when more than one product is added to the cart, or when a product belongs to more than one category. It sounds like you have an answer for this for your specific needs, but if you want to create a flexible calculator you might want to provide options for this as well.

share|improve this answer
    
Yeah I was thinking of pulling from a category group, then creating a custom shipping price field in the categories. This would be the most flexible in that an admin could change the prices themselves. If it more than one category is added or more than one category is set for a product, the larger price is taken. I'll see what I come up with... –  Aaron Dec 27 '12 at 10:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.