shipping rule according to the option labels of attribute

Permalink Browser Info Environment
Hi,
I'd like to set shipping cost rule using the attribute option.
Could you let me know what is the variables for the option labels?
Thank you for your help.

Type: Discussion
Status: New
ahncho
View Replies:
jb1 replied on at Permalink Reply
jb1
Hi

The shipping configurations can be found in the Dashboard>eCommerce Express> Shipping.

Does that help?

JZ
ahncho replied on at Permalink Reply 1 Attachment
ahncho
Thank you for your reply. Yes, I know it, but my plan is a little bit complicated. Please let me explain:
This online shop sells Wine. Because of the packaging materials differences the articles are necessary to be separated in two groups before the whole of shipping costs are totaled. So I gave an attribute to distinguish them. ("Bottle_type" - see the attachment)
So I had created two values (Bordeaux bottle, Bocksbeutel ) as Bottle_type variable.
One box can contain 3 bottles of same bottle type. The different bottle types cannot be contained in a same box.
For example, if client choose 1 Bordeaux bottle and 2 Bocksbeutel, it's necessary to prepare 1 box for Bordeaux bottle and another box for Bocksbeutel separately.

So it could be like followed, but I don't know how it's possible to take a quantity according to the attribute. How should be the first line?

switch (Bottle_type) { 
case "Bordeaux bottle" :
if (this.quantity <= 3) {return rate*50;}
if (this.quantity <= 6) {return rate*70;}
if (this.quantity <= 9) {return rate*120;}
if (this.quantity <= 12) {return rate*140;}
case "Bocksbeutel" :
if (this.quantity <= 3) {return rate*60;}
if (this.quantity <= 6) {return rate*80;}
if (this.quantity <= 9) {return rate*140;}
if (this.quantity <= 12) {return rate*160;}
default : 
if (this.quantity <= 3) {return rate*50;}
if (this.quantity <= 6) {return rate*70;}
if (this.quantity <= 9) {return rate*120;}


I'm really appreciate your help.
jb1 replied on at Permalink Reply
jb1
Hi

The custom attribute is accessed via this format
this.YOURCUSTOMATTRIBUTE
You need to change the
switch(Bottle_type)
to this
switch(this.Bottle_type)


Hope that helps.

JZ
ahncho replied on at Permalink Reply
ahncho
Hi, thank you again.
unfortunately it doesn't work.

I would like to calculate the shipping charges for each attribute of the product.
Is it possible to create a rule for each attribute of the product?

I'm really appreciate if you could advice me.
jb1 replied on at Permalink Reply
jb1
I think I know where the confusion is. For attributes with spaces you need use this pattern:

this["bottle-type"]
// So that would be
switch (this["bottle-type"])


Because eCommerce Express modifies custom attributes with spaces to dashes "-" and javascript recognises "-" as subtraction.

Does that make sense?

JZ
ahncho replied on at Permalink Reply
ahncho
Hi JZ,

thank you for your advice.
Actually our shipping rules are quite complicated, so that I can't find the solution by myself. Can I contact you to order the customization? If it's possible, how?

Thank you for your answer.
jb1 replied on at Permalink Reply
jb1
Hi

Sure you can PM me the requirements.

JZ

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.