Showing posts with label Drupal Commerce Shipping. Show all posts
Showing posts with label Drupal Commerce Shipping. Show all posts

Saturday, 26 October 2013

Drupal 7 / Ubercart Video Tutorial 9 of 10: Creating Product Kits, Store Stock and Order Status




http://www.ubercart.org/docs/user/30436/ubercart_3x#S1E9
[related: https://veg-buildlog.blogspot.com/2015/07/shopkeeper-puzzle-how-products-are.html which is about attributes from a stall-holder's point of view]
In the 9th Drupal video tutorial of this series, we continue developing our Ubercart site by
  • configuring product kits,
  • setting up store stock and
  • looking at our order states.
This is the final video tutorial before we actually test our site and push it live.

http://www.youtube.com/watch?v=cX8wpEzhFt8


[Drupal 7 / Ubercart video tutorial 6 of 10 showing how to set UPS, Paypal, and conditional taxes]
[Drupal 7 / Ubercart video tutorial 7 of 10 showed how to use the default catalog module]
[Drupal 7 / Ubercart video tutorial 8 of 10 showed an alternative flexible method of showing a catalog]
[Drupal 7 / Ubercart video tutorial 9 of 10 shows how to use product kits, stock, and order states]
[Drupal 7 / Ubercart video tutorial 10 of 10 shows a simple checkout, reports, and suggests a theme]

Hullo and welcome back to the ten part video tutorial series on using drupal for ecommerce with ubecart. I am Pete Yarorski, the Toronto website developer specialising in Drupal, and like all the video tutorials in this series, this is brought to you in a collaboration between myself and the Ubercart.org team.

Following-up on the previous video tutorials....
We have gone-ahead and created our site. [0'23]
We are pretty close to having it finished and launched. [0'25"]
But there are still a few things we need to cover, which include
-setting up product kits, and
-stock notifications .

In this video tutorial, I hope without talking too long, we will cover
-checking-out an order, and covering the
-order status workflow [from a shopkeeper's or a programmer's point of view].

So, with that [introduction], let's dive right into it [the rest of the video].

Product Kits

The first thing we are going to do is take a look at setting-up product kits. [00'46"]

If you are not familiar with product kits: essentially what they are is an item in your store that will pull-in various Ubercart products that you have already created, so [for example] you can specify two products [as a customer] and specify that specific discount for your customer [as a shopkeeper or developer]. [01'02"]

I'll show you that in a quick second, but, just briefly, we can go to [admin] store>configuration>products>product kit settings, and we can set the default for when we are setting up a product kit.

The three different options are essentially that you can create a
  1. unit, and not list the components when you check-out, or
  2. product list and components when you are checking-out, or
  3. put all the parts in to the checkout and let people choose individual parts as they want to.
We are going to leave it [the default setting] as a unit and let people see the individual productst as they order.  [1'30"]

Now, to add a productkit  to our site we are going to
content>add content>product kit
Just briefly - when we do this: remember that we have set-up our specific urls when we went to
configuration> search and metadata > url aliases > patterns
We set these up for product kits as well, so if you don't have the proper-looking url down here at the
content>add content>product kit> ?create product kit?>pathauto settings [near the bottom of the page on the left], you can go over there and set that up.[01'56"]

Now this:
[name in the name box] will be "Super Saver"
[description in the description box] "buy two products and save big"? - I dunno. Give it a proper description, based upon what you are actually creating, but, again, for this video tutorial we are not going to do that, and,
[image in the image box] as always, we are going to put Bailey [the dog picture] up on our site.
[How is this product kit handled by the cart?
-as a unit
-as a unit; list individual products - default option
-as individual products] We will leave this as the default settings.[2'21"]

[Products
-download of purchase
-Pete's awesome product
-Pete's super awesome Drupal book
-Pete's super awesome T shirt] And what they're going to get - any customer that purchases this kit - is going to get our Drupal book and a Drupal T shirt. [because they are highlighted on the form][2'26"]
[list settings] We don't have to change the list settings.[2'32"]
[shipping settings] Interestingly we don't have to change the check-box for "make product shippable"
So you'll see, when I save this, that I will get an error-message. I will explain that to you when we do that.
[menu settings]
[meta tags] Beyond that, you know, we can add some seo tags.
[revision information]
[url path settings]
[xml sitemap]
[comment settings]
[authoring information]
[publishing information] The rest of this ought already to be set-up

[published]
[promoted to front page] We just need to promote to the front page so we can see it.
[sticky at the top of lists]

So, now we have got our image up there, let's go ahead. We will press save and continue.[2'54"]

[Notice: undefined index. shippable in uc_usps_product........line_134. ] Here is the error message that I warned you about. It is usually in relation to an undefined variable.
So looking at line 134 of this module's code, it just relates to the form of code for UPS [United Parcel Service], it just relates to
the form settings: whether or not "shippable" is set. Because the "shippable" setting is not enabled for a product kit, it looks as
as though [that is why] we are getting that error. If you ran into something like this, it would be a good time to post an issue on Ubercat's
mainenance page on Drupal.org. I have not gone-over to check whether this might be already addressed, or already pointed out: that kind of thing. So: it won't affect
us, but if you are doing this, and you get that error message, that's the issue.[3'36"]

The reason why we are not pressing "save and continue" is that we have the opportunity to apply discounts here.
So if we bought these two individual items, our total would be $109, but if we want to add a heavy discount here for users, we can do this:
[Total price box]$70.
We'll make that $70, and then if we press "save and continue", that discount is applied to both products. Not necessarilly evenly, but we can change that if we like to.
Actually, it looks like it [the default reduced price on each item] is probably a percentage of their costs, so it could have been applied evenly.
Obviously, you can change around the quantity and the discounts if you want to, but now we can go over to preview.

And of course we get tonnes of errors. This is not necesarilly a good thing. We don't really need to preview; I meant that we can go to view.
There when we are reviewing the product, we see $70. The two products that we are specifically getting here, the image for our product,  and then we had an attribute on the awesome book, so we can choose whether to use that as well. We will go to yellow.
[add to cart button] And now if we added this to our cart we can see here that we've got $70, we have got the colour yellow, and our two products are listed.[4'46]
So that is creating a product kit. It is pretty straightforward; it's pretty easy to to, and it's a nice convenient way for you to add products to your site for users, obviously, not to have to purchase the items individually.[5'00]


Stock


From that, which is a pretty basic look at those [kits], we are going to look at stock notifications
Just briefly, we will step into Pete's Awesome Product here. Actually: I am sorry. Before that,
we are going to go to

store> configuration>stock notifications

This is just the default setting for the stock notification system itself.
[send an email when stock reaches a certain threshold] we will send an email when stock reaches a certain threshold, because I want to maintain my stock levels, so I want to know that.
There is the subject [of the email] that I would get, and the text.
[presses "save and continue"]
So: pretty basic; nothing complicated.[5'35] We'll save those configurations,
[content> ] and now if we go to our content, we can actually enable stock notifications for a specifict product.[5'43] So...
[looking at a list of products with links] What we were going to look at was Pete's Awsome Product, I think,
[clicks on the link for Pete's Awsome Product]
[clicks on the view |edit tab on the product page] and we will edit this, and when we edit the product we will see that there is a
[product | attribute | features | stock ] tab for stock, so we will go-ahead
[check box under heading "Active"] So we will check "stock". This check-box would normally be un-checked [6'00"], but we will go-ahead and check that off.
[box under heading "STOCK] And we will add our stock [amount] here. I have already created an order, and that is why I am at minus two. So let's say that I have 100 in stock
[box under heading "THRESHOLD"] and my threshold is 10. So when I have 10 left, I get an email that says "you are getting low".
[button "save changes"] So I save those configurations,
[screen returns to the view wnd edit product page] and review the product. Nothing changes here for the product the customer or anything. They have no idea what your stock levels are at, and ubercart by default will allow customers to continually purchase the item, regardless of the stock level.  This can be a good or a bad thing. This can be a good or a bad thing for you. You know, if you are dealing with a physical product, you could have something that goes to back-order, but you don't really want them to know it, but then you don't really know when it is going to ship, and you can create some issues there. [06'50']

If you are looking for a solution where customers can't purchase if there is no stock, there is this module, which is the out of stock module. [7'00"] This will replace the add to cart button with an out of stock message. The good thing about this is that customers can no longer order something that is out of stock. The bad thing is that you don't know if someone is trying to order a product that is out of stock; you are not really sure what your demand is.  Nonetheless, I will briefly show you here: I have installed the module to give you some kind of idea of what we are looking at.
modules>
So I scroll-down to Ubercart Extra modules... Out of stock notifications [button: save configuration]. Then we will enable this. [enables module].
Then when I go back to my product [view | edit screen], I have 100 in stock, so the customer knows that. And if you go-over to [the stock page] stock, [stock column] press zero. Save changes.  Go back to our home page. You see an "out of stock" message. [7'57"] That "out of stock" message is actually customizable. [08'00"]
store> configuration > store > out of stock notification
...over at out of stock notifier. Or notification. Sorry.
[on to a page of options]
[tickbox: display throbber = moving wheel on the button] And we can display this "throbber". which is a kind of annoyance, so we can take it out.
[tickbox: display customer stock information] We don't have to show customers the stock information, so customers will not see that.
[pre-filled message box reads "out of stock"] What we see here is what customers are going to actually see.
And this is dependent upon our html here. So this is, by default, filtered. So if you saved that, you would see this whole thing. By default we have the red [text]. But you can set that as whatever.
[button: save configuration] go ahead and save the configuration. And there we go. So if we go back to our home page. [8'33"] you will see "out of stock", and that we have removed the actual notification for the throbber and for the actual stock level. But we don't see that because we are out of stock anyway.

So that was that module. Again, there are positives and negatives to both [ways of displaying out of stock items] . It [the best option] depends on what your preference is.


So that was product kits , and that is stock notification.
That's typically it for the Drupal set-up with Ubercart.

Now, wrapping things up, what we are going to do is walk you through the process of making an order and  walking-through the order status, just so you are aware of how that works, and some of the options that you have. That we will be it for the tutorials.



order process


So lets go ahead and do that, by going back to Products, and I think we have already added that [product] to the cart, but we will go ahead and add to cart.  So we are going to add two of these. We are going to have the $5 and the $2. Just as a point of reference, we had the $5 which added another $5 - sorry
we had the colour attribute black which adds a $5 charge to our products so it adds $75 as opposed to $70 (the yellow does not have an increase). So we will go ahead and checkout, and if you remember....

...we've got some issues here with our out of stock module, so maybe it wasn't as great as I recommended: use at your own risk! I apologise for that.

But we will go ahead. We will check-out here [10'01] This is all set-up on my sandbox site, so I can checkout with that. Again, I would recommend that you do this in a sandbox site, just to check that your order statuses work and that you can checkout. So: we are reviewing our order. Everything looks good. We are shipping to Hollywood. And now we can go-ahead and submit that order. Again, I have my sandbox customer ID. This was set-up in one of my previous video tutorials so, hopefully, if you followed along the entire series, you know what I am talking about there. Now I can check-out here. [10'34"] I can go to "pay now".

Just briefly, here, again, you see the individual product items [in a paypal shopping cart and payment screen], rather than having the product kits listed. So if we had changed that and we had just listed product kits, it would not be the individual products [showing] here.

So we can go ahead and pay now. We have just completed our order so we will go-ahead and return back to the site. [which says "order complete"]. So we can now go to our orders and check them out
store>orders>view orders
and you will see here that the newest one at 1.45 was completed.
The reason why it is completed is that the products that we had were not actual shippable products. We did not set those up to be shipped by UPS or anything, As a result, if we go to our order status here, you will see that we got that payment. We got the payment and boom! the order was completed. There is not much [else] going-on there. We could send, you know [11'30"] an order comment, and then send that (by pressing "update") to the customer himself or herself, and that would be it. Again, if you take a look quickly at the log here, it shows you how this proceeded through our system.

Now that is all great for the one product that, you know, isn't shippable, and is available online, like your product roles, or your downloadable products. But if you have a shippable product, there is going to be another product that you are going to go through.  So let's go ahead and do that. [11'55"]

content>

I am going to go to my content and [click on] I think "super awsome T shirt" - this is a T shirt with Bailey's photo. It is an actual shippable product. So we will go ahead and add this to the cart. We will check-out. And we will choose "1 Main Street". My billing address is the same as my delivery. We have got our shipping options here - so we will keep it [the option] at $15. We will go to review. We will submit the order. Enter a password. Pay now. And [12'39"]
when we return back to the store, when we go to
store>orders>
You will see here [next to the order] that we have "payment recieved"; we are not actually completed. The reason for that is that this is a shippable product, and we actually have to package and then ship. So, the next step here, if you are administering a site like this, is you go to your
|VIEW | EDIT | INVOICE | PAYMENTS | PACKAGES | SHIPMENTS |
"packages", and we will make a package, [12'59"]. This is going to be in packet one. So that is done. Now we go to
|VIEW | EDIT | INVOICE | PAYMENTS | PACKAGES | SHIPMENTS | ...
[dropdown menu: ship manually] We are going to ship it manually, and so in doing that, we have the saved address - the ordering address, the destination - where it is going which is to the customer, the package and we obviously have one,
[box: package type] you can enter a package type if you want to here
[box: declared value] you can enter a declared value, again, if you want to
[box: tracking number] if you have a tracking number - so if you are using UPS - you can manually enter that in.
[boxes: weight, dimensions] Weight in pounds. Again, all of that information which can be included.
[boxes under a "shipment data" heading] Now: shipment data. Because we are doing this manually, we would be entering this data in for whoever our shipping [company] was - you know, perhaps we are using [?] data, and, you know, we don't have that installed in our site, so we go ahead and do that.
[drop-down menu for number of days' delivery] Expected delivery will be - say - the 31st.
[box: shipping cost] Shipping cost is  - I don't know - let's say $10.
[button: save shipment] We will save the shipment

We can also go and them print the packing slip.
And if we checkout the log, we see that nothing - we see that here we don't actually have the completed [order] or anything beyond pending - right? That's right. And "payment recieved".

So if we now go back [14'21"] what we can do here, is that now we can go to
[box: order status] completed, and we can add an order comment and say "order shipped October 27th" "tracking number is..." and then enter a tracking number
[checkbox: send an e-mail notification on update] make sure we send an email notification to the customer
[button: update] press update.

And now our order has been updated. We see that here, the order status has been changed to shipped, our customer has been notified, and then when we go and actually check our store orders [it's done]. So the one thing [to remember] here is that we went from the order completed meaning "payment recieved" to mea


We might want to indicate that there is a step between them when we are actually shipping. So if we went into confuguration unders
store>orders>workflow
you will see here that we have the order statuses. We can go ahead and add a custom one, and we will say
[box: order status id] shipping
[box:title] Shipping
[drop down: payment recieved] payment received
[button: create] So we will go ahead and we will create this.
And now you see that we have "payment received" here.
So now what we can do, is that we can go back to our orders themselves, look at this [order], and it is not completed; it is actually shipping. So if we update this and we go back to our orders, we now see that this is shipping. Right? Once we have confirmation that it has been delivivered from our courier and we know that we are good, we can come back in here and then enter it as completed. Again, it's a minor thing; it's totally up to you. You could also add another status that says, you know, that is is packaged, so then you know during the day - maybe you have a pickup every other day or something along those lines, maybe you could have something hanging around in your warehouse that is packaged but not actually shipped.

So that's it for this video tutorial.

In the last video tutorial what we will do is wrap everything up, to take it to [being] a production site, which is not very complicated. It is pretty much just our UPS [United Parcel Service] and our  and our Paypal that we want to change-over. But we also want to walk-through as an anonymous user to make a purchase, and a few other things.

So, again, if these video tutorials are helpful, leave a comment, let me know. Hopefully we will see you in the next video tutorial. Thanks very much


[Drupal 7 / Ubercart video tutorial 6 of 10 showing how to set UPS, Paypal, and conditional taxes]
[Drupal 7 / Ubercart video tutorial 7 of 10 showed how to use the default catalog module]
[Drupal 7 / Ubercart video tutorial 8 of 10 showed an alternative flexible method of showing a catalog]
[Drupal 7 / Ubercart video tutorial 9 of 10 shows how to use product kits, stock, and order states]
[Drupal 7 / Ubercart video tutorial 10 of 10 shows a simple checkout, reports, and suggests a theme]

Tuesday, 11 June 2013

Using Calculation Rules to Add Per-Item Shipping in Commerce Shipping

Transcribed videos: -
[Drupal 7 / Ubercart video tutorial 7 of 10 showed how to use the default catalog module]
[Drupal 7 / Ubercart video tutorial 8 of 10 showed an alternative flexible method of showing a catalog]
[Drupal 7 / Ubercart video tutorial 9 of 10 shows how to use product kits, stock, and order states]
[Drupal 7 / Ubercart video tutorial 10 of 10 shows a simple checkout, reports, and suggests a theme] These videos are not related to the transcription below but may help anyone trying to get a Drupal ecommerce site running as quickly as possible.


Text introduction:
In this screencast I demonstrate how to do shipping charges per item in the cart. It shows using a loop in Rules and how to do something new and different with shipping.

We want to add $5.00 to the shipping charge for every item they have. So if the quantity is 5 for some line item, we'll add $25 to the shipping charge.

The technique is this:

    Add a shipping service. We're using a flat rate service with a $10 base rate.
    Add a new "Calculation rule" for that service.
    Add an action loop that loops through the line items in the order.
    Add an action "Calculate a value" & multiply the quantity times 500 ($5.00) & put the result in a named variable.
    Add an action "Add an amount to the unit price" that adds the named variable to the unit price of the shipping line item.


Using Calculation Rules to Add Per-Item Shipping in Commerce Shipping from Randy Fay on Vimeo.
Hullo! My name is Randy Fay. I'm [email]on Drupal.org, and I work with Commerce Guys on their Drupal Commerce Project, and I've been doing a series of screencasts showing how to configure shipping - Commerce_Shipping 2.0 - and I've demonstrated the new Commerce Flat Rate module, and also how to use Commerce UPS.

I want to show some more advanced rules techniques now.

I hope that if you aren't familiar with Shipping that you watch some of the other videos first because we are going to pretty deep into Rules this time. But lets just take a look at what we have for configuration, first of all.  If we go under Store>Configuration>Shipping , we have basically three things that we can configure, and we've looked at these in previous videos. [shows as three tabs on the screen]

|SHIPPING METHODS | SHIPPING SERVICES| CALCULATION RULES |

Under SHIPPING METHODS [tab] we have the provider, essentially. It could be flat rate, it could be UPS, it could be something else. And then each one of those can create SHIPPING SERVICES so we can create flat rate services for example, and I actually have a plain vanilla flat-rate service set-up here.  But the tab that we haven't looked at yet is called CALCULATION RULES. That's what we're going to do this time: we are going to demonstrate how CALCULATION RULES work.

Let's just take a look at what we have in the flat rate SHIPPING SERVICES right now: we don't have anything. It's just plain vanilla. And we have this - er - set up just for flat rate, and if we go back and look at the quick edit link here, we will see that this is the $10 base rate. And if we go to the checkout right now, every order would cost $10. - but..

Let's just say that we are actually going to charge per item that we put in the cart; that we do not want a flat rate. We want to charge per item with a minimum of $10. Let's say $10 plus $5 for each item that we add to the cart. Because each of these things costs us money to send. Let's go ahead and work on that. We'll use CALCULATION RULES to do that.

Again: our goal is to have a $10 flat rate, which we already have, and to add to that $5 for each item that they [the customer] have in their cart. So each item is not a line item; it is line item x quantity in that line item , so we have to do the calculation here.

We are going to go to CALCULATION RULES [tab]...

 |SHIPPING METHODS | SHIPPING SERVICES | CALCULATION RULES |

...we are going to say "add a calculation rule", and this is going to be [3'00"]
Name: "Add $5 for each product shipped", let's say.

When we do this calculation, what we have, is:
We are listening to the...
 Events EVENT Calculating a shipping rate
...event.
What we get passed into this rule is a shipping line item that is all ready-to-go; it has everything we need.
But when we see a line item here in this particular rule, it is the shipping line item and of course the shipping line item is associated with the order which can access the rest of the line items, which is what we are going to do.
So we have a shipping line item in our hands. Now we have to, under Actions, we have to  add a loop. We have to go through each of the line items and figure-out how much we need to add to the cost of shipping [4' 00"] for that line item.

We are going to add a loop here: +loop. The List that we are going to loop over is going to be
Add a new loop > List > Data Selector >

that is the list. So we are reaching out of our shipping line item out into the parent order , and from there we are getting the line items. So now in the current....
Now we have to name these things [by typing a name into the box], so I am going to call this
CURRENT LIST ITEM > Variable label> "line item"  and
CURRENT LIST ITEM>  Variable name>line_item

Now we have a way to examine every line item.
I am going to add an action...
Actions > OPERATIONS > Add action
Be careful to click the +Add action here [on the right, under OPERATIONS] under the loop rather than under the Actions [at the bottom left of the box in a blue stripe] [5'00"] or it won't be doing the right thing. You can drag these things around and place them in the right place. But this action needs to go under the rule.

What we are going to do is we are going to calculate data values
Add a new action > Select the action to add > calculate a data value
So we are going to multiply the quantity x $5.
We are going to say ... our commerce line item ... quantity : quantity is in there ...
INPUT VALUE 1 (the first input value for the calculation) > Data selector >

We are going to use multiplication

OPERATOR (the calculation operator) > Value > *
Down here we are going to put a value.
INPUT VALUE 2 (the second input value.) > Value > 500
In Rules we are always dealing with minor units, so 500 there for £5.
The result of this is going to be [types-in a name][6'00"]
Provided variables > CALCULATION RESULT > Variable label > "Calculated Line Item Shipping"
Provided variables > CALCULATION RESULT > Variable name >calculated_line_item_shipping

So this is the total shipping that we will add for this line item, which comes from multiplying the quantity of the line item times $5.

OK, so now we have that information.
Now we need to add one more action.
I will add an action here
Actions > OPERATIONS > Add action
Now what I am going to do (under "Commerce Line Item" among the options on the drop down menu) is choose
Actions > OPERATIONS > Add action > Add an amount to the unit price
Here we are adding to the shipping line item's price. We are all set here.

[7'00"]
The amount, though: I need to switch to
AMOUNT > Data selector and use the
AMOUNT > Data selector >

...which we have just created.
I am going to say that the Component should be flat rate.
PRICE COMPONENT TYPE > Value >
...
This isn't flat-rate shipping any more, but we'll call it that. um - so
What we are doing here is that we are adding another action that applies to this shipping line item that we have in our hands.  So. And..
We are going to add the amount that we calculated.
AMOUNT (specify a numeric amount to add to the unit price) > Data Selector >
..... to the existing amunt, and put it into the flat rate. So let's try that.
Take a look at the rule that we have. So this is just a standard thing.
We are listening for when calculating the shipping rate .
We don't have any conditions at all.
We create a loop.

Actions > ELEMENTS > Loop Parameter: List [commerce_line_item_order...
List Item [line_item]
> Calculate a value
Parameter: Input Value 1 [line_item_quantity], Operator:[*], Input Value 2: 500
> Add an amount to the unit price

And the loop is... the first thing it does is calculate... [8'00"]
It's a loop of line items, and for each line item, it calculates how much we should charge for that line item by multiplying the quantity - we have 500 here - and then add that amount to the unit price. And now we ought to have this. Let's go ahead and see what we've got.


I'll go out here [to a shopping page] and see what I've got. I've got some cheap products and some expensive products. I'll buy a Heavy Product and a Light Product
We expect that the shipping should be $10, which was our base rate for shipping, plus $5 for each of these line items. So we are expecting to ay $20. So we go to checkout. Order total is $100.  We go to the next step and calculate the shipping. And it shows $20. [9'00"] Which is what we expected. So lets go back and we will do that - lets change the cart where we have one light product, so that we have nine of these products. So now we have ten items in our shopping cart.  Ten items in our cart. So were are expecting to pay 10 x 5 + 10, so it should be $60. Let's try that. And the flat rate amount that we are expected to pay is $60. So that's working correctly. Let's go ahead and do that...

Oh I wanted to show you one little thing that I like to do when I am working on these things.
I should actually show you two things that I like to do when I am working on these things.

One is that I always edit the Views that I need to work on, to make them show the components;
I like to see what the components are, that are going-in to these. [10'00"] This [technique] is really useful with tax, and it's really helpful here as well. So you see that we have the flat-rate component. Anyway, I recommend changing the formatter on some of these fields to - Showing all the components, when you are working on something. The

Other thing that I recommend is:
Always turning-on the Rules debugging when you have any questions. So if you go to
Admin > Configuration > Workflow > Rules, and go to Settings
Turn on "show debugging information Never In case of errors  Always.
And then you will be able to debug - to debug quite a number of things. Let's go back here to our ordering [page]. I'll refresh it. [11'00"]. And here is our old [Rules] evaluation log. We can do down and we can see all of the things that we wanted to see.  And drill-down and study them very carefully. It takes a bit [of patience] to get used to this but you really have to do it; you have to understand how that works.

OK: sorry about that little diversion!

What we did is that we wanted to add $5 for every item in our cart.
What we did was we went to Store > Configuration > Shipping and we went to | CALCULATION RULES | this time, and we added a single rule which only had actions in it. It had a loop that went through the line-items and for each line-item it calculated the quantity x 500 (or $5).  Then it added that amount; it stored that amount in a variable. It added that amount to the unit price.
OK?
Well I hope that helped, and I hope you're doing well with shipping. Thank you so much for listening

If anyone is interested in stuff from the same person who transcribed this video, here is a series about Ubercart.


Monday, 10 June 2013

Why is this difficult / expectations for minimum basic shipping

Transcribing a video about Drupal Commerce shipping options, I thought I might be on to something.
A couple of days later I tried to follow the instructions myself and soon discovered that the video describes a simple case, but that other modules exist on the Drupal.org site and here:


The trouble is that the ones for a shipping matrix by weight and destination or perhaps courier are not finished.
One has a dozen or so users.
One has sixty but writes that the project was halted; there is no user interface, bugs are acknowledged but it is for another maintainer to sort them.
Those of us who are not in the states obviously need this module more than shopping cart authors need to get them written. To me, a shopping cart is not past alpha release unless it can ship to the home country, part of the world, and the rest of the world on three different weight scales alongside a few more for different kinds of delivery. This is what I already have on my simple entry-level shopping cart from mals-e commerce which allows 5 types of delivery that can be subdivided according to price or a value that you add to each order form link for weight. Paypal's free shopping cart links probably offers something similar. If you pay a small subscription to mal's you get more options, but most settle for this entry level.

Obviously, to open source software developers in the states, it is OK to release something and watch people write additional modules that they explain as being un-finished because a project fell-though and they are short of time.

So: back to watching this video about how to sell things for $0 shipping in Colorado and $10 shipping in the rest of the world, which happens to be the USA. Until I can find an open source shopping cart system that started in Europe.

Sunday, 9 June 2013

Introduction to Commerce Shipping by Randy Fay


Introduction to Commerce Shipping from Randy Fay on Vimeo.
Finally Commerce_Shipping [module] is coming of age!

I want to give you a quick tour of how to do some things with commerce shipping.
What we're looking at today is this
So that's what we are going to work with. (and) [50" fifty seconds into the video]
What we are going to do is, first of all,
  • we are going to create a flat rate shipping class; we are going to say that it costs $10 to ship.  Then, after we experiment with that,
  • we are going to create free shipping, for products that are within Colorado. So we'll just go and change the rules, and we'll have free shipping within Colorado, and $10 shipping outside Colorado. So lets' give that a shot.


First of all go and enable the modules. So we will go over and enable the modules here [from modules>list he uses a filter to find "shipping" and "flat rate" which are installed as part of the Kickstart distribution he's using]. OK. Well. I'd already enabled them, but those are the ones that you want, and you'll find them under Commerce (Shipping) [picking from a grey-backed column on the left side of a page] you'll want Flat Rate, Shipping, and Shipping UI. [Shipping User Interface]

Later on, in another podcast in another screencast, I will show you how to do UPS [United Parcel Service] and in a further screen cast we'll do some more complicated rules like "free shipping over $100" - that kind of thing. 

But in this one, we're just going to do two shipping rates, one for within Colorado and one for outside Colorado.  We'll give that a shot and see if we can make that work.

So the first thing we're going to do is: we'll go-over to Store>Configuration>Shipping, and we're going to take a look at what we have here: We have [three tabs] -

| Shipping Methods | Shipping Services | Calculation Rules |

All we are going to do today is we're going to look at | Shipping Methods |, which is just there [the visible tab] by default: Flat Rate [method] is what we've got [by default], and | Shipping Services |. We can have one or more Flat Rate Shipping Services. You could think of them as "shipping instances", or whatever you want to call them.
[3'10"]
I'm going to say "add a flat rate service", [does so] and I'm going to say... I am going to call it "Flat Rate", and it's going to be $10. And now we have a new shipping service, under the tab

| Shipping Methods| Shipping Services | Calculation Rules |

Display Title: flat rate... ... ... ...  so this is all set-up. It will automatically be available as a shipping method for any purchase that we make. So let's go ahead and make a purchase.  We'll buy "product three" - how about that! Checkout.  And [add] shipping information.-I'm going to be in Palisade Colorado. Fill this in here. Continue-on.  We see that we are offered Flat Rate Shipping. That is the only service that we have to find.  And we go for it. So, here we are [at the "review your order" screen] - it's done exactly as we asked: it has added flat-rate shipping $10 on to our charge.  and... I've got no payment required. I've got free payment. That's not something you'd want on any site but I can have free payment on this one!

OK - so, Now.
I want $10 shipping in the rest of the USA but in Colorado I want just free shipping.  So there is
What we need to do is create another "free shipping" type. We're going to Store>Configuration>Shipping, and we're going to add another flat-rate service. We'll call it "free shipping inside Colorado".  [copies text for display title. leaves description blank]. And... price is zero.  [presses "save"] And now we have another service: it's called "free shipping inside Colerado"

What we need to do now is remember that this is a Rules component [of the Rules module].  Every rule has an 
  • event, a 
  • condition [or condions] and an 
  • action.  [points to the Conditions and Actions sections of the screen].  
Events are what a rule listens to, conditions decide whether it takes the action, and actions which are things that we are going to do. We are already listening for the "rate shipping" event, and we are going to say "should this rule apply to us", in other words "should we select free shipping"

[5'19"]

...so I'm going to add a condition [from a long drop-down menu including "Commerce Order" as a subheading in bold], and it's going to be a Commerce Order address component comparison. So there we go. The value that I want to compare against: the address that I want to use is the shipping address.. The address component that I want to compare is, first of all, I want to compare the Country. I'll make sure we get the country in there. Otherwise, there might be a "CO" abbreviation in some other country. By the way, this is the two-character country code for the country that I was talking about.  So we have a condition for that.  Now we are going to add one for the State. We're going to do the exact same thing again - Add a new condition> ORDER>Data selector> commerce_order

It's the shipping address that we want... [on the same page further down]
ADDRESS COMPONENT>Value>Administrative area (State / Province).
VALUE>Value
The two-letter code for Colerado is CO.
Save.

So now we have - er - two conditions on there [in the Conditions ELEMENTS box] One is:
Is the country US? The other is
Is the state Colerado?
Then we're going to add that there [in the Actions ELEMENTS box below].

So now we are going to go back and fix the other one so that we don't offer free shipping.
So let's go ahead and do that: we're not going to offer free shipping anytime that they are not shipping to Colerado. So: Store>Configuration>Shipping>ShippingServices 
And now we have to edit the flat rate - and this we don't want to offer if they are outside Colerado.

So let's just say that we only want to offer shipping in the US, because that's [  ] a separate thing.  So lets just go ahead and say [on Add a new condition] ORDER>Data selector ...
and the value of the administrative area [options are = / not =  / contains] lets say "equals" CO. And then we're going to say [with a tick box just above the save button at the bottom of the page] "Negate":  [9'30"] This does not contain Colerado so don't do it. Save.

Lets go ahead and add the other condition, about the US.
Add a new condition > Select the condition to add > drop down menu
Commerce Cart > ?
...just in case there is some other sort of thing [that has a CO abbreviation]. We'd probably take care of this another way, by offering a different shipping [service] outside the US, [which would] just tell them that we couldn't do it.
DATA SELECTOR > Country >
OPERATOR > equals
...just for now I am going to say "equals US"
We are going to say that this [flat rate shipping rule] applies to shipping that is in the US, but is outside Colerado.
[...]

And so now lets go-see if that works: [10'35"]
...you'll see that it already thinks that I'm in Colorado. No - it just doesn't know yet. It didn't ahve any information. Now we know. Now lets try again. Lets try shifting the state to Kentucky. ...and now it's offering only the flat rate $10 ammount. So now it's doing what we told it to do. The first time we tried this, we didn't have a way to choose [where we are] at the checkout.

...Colerado: then we get free shipping.


Let's just take a look at what we've done. First of all we've used
Commerce_Shipping [module] 2.X . We've used
Commerce_Flat_Rate - (
not the older (what do you call it?)... not the older Commerce_Shipping_Flat_Rate, which is basically depricated now.
Using those two, we have gone-in to Drupal admin (with Drupal Commerce enabled and a Store menu on admin).
  • We have gone into Admin>Store>Configuration>Shipping
  • We have a flat rate SHIPPING METHOD.
  • We hae added two services. Let's take a look at the two services we added. The two services are
  • Flat Rate (Machine name flat_rate), which is the $10 one, and
  • free Shipping inside Colorado (Machine name free_shipping_inside_colerado), which would be $0.
  • And then we added a Rules component to make sure that they were chosen at the right time. So free shipping is chosen if we are shipping to the US, and we are shipping to Colerado.
  • And we did the opposite on the other one.
So that's the basics! That's the first and easiest configuration of flat rate shipping .
I will do a couple more screen casts. I'll do one on Commerce_UPS, which is now working, and I'll also do one on fancy rules. So, thanks for listening, and see you in the issue queue and everywhere else! Thanks - bye bye.



.

Tuesday, 26 February 2013

Ambiguous instructions and hidden costs

  • Ambiguous instructions
  • Hidden costs

These are the problems for Drupal, made better or worse by evangelical support from people who give lectures or go to groups. It seems rude to someone who is saying "straight out of the box" in a lecture that the thing does not even turn-on for some parts of the audience. It seems rude to parts of the audience that a product does not work from available instructions, and incurs hidden costs.

Just for now I will experiment with Wordpress E-commerce but hope to come back when the first textbook writer dares put instructions in print. I have paid my deposit.