Category Archives: Modules

How to customize the theme of Ribbon and Countdown in X-Discount

It is possible to change the theme colour of the ribbon and countdown in X-Discount. To change your theme, you will have to put your custom CSS rules to the field Custom CSS located in the Global Setting tab of the X-Discount.

Custom CSS in X-Discount

Here are examples of the custom ribbon and countdown:

Example 1: Red Round Ribbon

Required CSS rules

.xdiscount_ribbon {
     background: #fc3f00;
     font-weight: bold;
     border-radius: 50%;
 }
 .xdiscount_ribbon:before {
     display:none;
 }

Example 2: Yellow Ribbon in right side

Required CSS rules

.xdiscount_ribbon_container {
     right: 3px;
     left: auto;
 }
 .xdiscount_ribbon {
     background: #fcd800;
     color: #111;
     font-weight: bold;
 }
 .xdiscount_ribbon:before {
     display:none;
 }

Example 3: Countdown white background

Required CSS rules

.xdiscount_content ._box {
     border: 1px solid #319cd1;
     background-color: #f5f5f5;
     position: relative;
 }
 .xdiscount_content ._box ._box_label {
     position: absolute;
     bottom: 2px;
     width: 100%;
 }
 .xdiscount_content ._box ._box_content {
     padding: 15px 0 25px 0;
     background-color: #fff;
     color: #3098cc;
 }

Example 4: Black Countdown

Required CSS rules

.xdiscount_content ._box {
     border: none;
     background-color: transparent;
 }
 .xdiscount_content ._box ._box_content {
     padding: 15px 0;
     background-color: #020202;
     box-shadow: 0 0 5px 0px rgba(0,0,0,0.5);
 }

Example 5: Gradient Countdown

Required CSS rules

.xdiscount_content ._box {
     border: 1px solid #7bc2ec;
     background-color: #f5f5f5;
 }
 .xdiscount_content ._box ._box_content {
     font-size: 22px;
     padding: 14px 0px;
     background: linear-gradient(0deg, #3f6a7f, #84d6ff);
     color: #fff;
     box-shadow: 0px 0px 5px 0px rgb(77, 171, 228);
 }
 .xdiscount_content ._box ._box_label {
     background: #e4f6ff;
     border-bottom: 1px solid #7bc2ec;
 }

Example 6: Round Countdown

Required CSS rules

.xdiscount_content ._box {
     border: none;
     background-color: transparent;
     position: relative;
 }
 .xdiscount_content ._box ._box_content {
     padding: 22px 0;
     background-color: #d7f2ff;
     color: #101010;
     border-radius: 50%;
     height: 80px;
     font-size: 28px;
     border: 3px solid #319cd0;
 }
 .xdiscount_content ._box ._box_label {
     position: absolute;
     bottom: 8px;
     width: 100%;
     color: #1c84b7;
 }

Example 7: Green Countdown

Required CSS rules

.xdiscount_content ._box {
    border: 1px solid #ccc;
    background-color: #3fbf91;
    padding: 5px;
}
.xdiscount_content ._box ._box_content {
    background-color: #288267;
    color: #fff;
}
.xdiscount_content ._box ._box_label {
    color: #fdfdfd;
    padding: 0px 0px 2px 0px;
}

Example 7: Without Hour Box

Countdown without hour box

Required CSS rules

.xdiscount_content ._days {
    display: none;
}
.xdiscount_content ._box {
    flex-basis: 33%;
}

How to select css selector for discount ribbon and offer countdown in X-Discount

As you know opencart has many themes on the marketplace and it is quite impossible to add predefined patches to all available templates. By X-Discount’s offer countdown and discount, the ribbon has been configured for the default theme. But it is possible to show countdown and ribbon on any theme. The Ribbon & Countdown Setting tab of the X-Discount module allows you to defined your own CSS selector where the ribbon or countdown will have appeared.

Let me show you how to find the selector using the chrome debugging tool. Let’s assume you want to place a ribbon on the product listing page. To do so, please navigate to any product listing page. Then click the mouse right button over any product box and then click the Inspect option. It will show up chrome debugging tool. Now find out a CSS Class that must be unique so it can be used to differentiate product boxes across the page. For example, for the default theme CSS selector .product-layout is unique.

Selector for the Product Box in default theme

Once you choose the selector for the product box, you will have to find out a selector where the X-discount actually put the ribbon in. For example, in the default theme, it could be .product-thumb .image

Selector for ribbon in the listing page

Similarly, you can get your selector for the details. Note in the detail page, the countdown would be placed before the given selector. For example, in the default theme, the selector #product could be a good choice.

Countdown in the product detail page

However, if you have any problem getting your selector, don’t hesitate to request support. Have a good day!

How does Cumulative Price work in XShippingpro?

If you set final cost to Cumulative,  xshippingpro will sup up cost of all unit rows and even applicable Additional Price. Let look into following setting:

Before continue into further lets discuss two things.

How doesXshippingpro calculate Per Unit Cost?
If you noticed, I have entered Per Unit Block is 1 for the second unit row.  Since cost is defined $2 to that row. So each block cost would be $2. Lets calculate how may blocks out there.
Start: 10.1
End: 20
So Total blocks:  (End – Start) / Per Unit Block = (20 -10.1) / 1 = 9.9 i.e Round value: 10
( One thing is worth to inform that Xshippingpro would not round if you would have set Allow Partial is Yes )
Therefore, Total Cost: 10  x $2 = $20
How does Xshippingpro calculate Additional Price?
If xshippingpro find a match among the unit ranges, it will not move forward to Additional Price. But if there no proper matching is found, xshippingpro will move ahead to Additional Price rule and try to calculate shipping cost depending on its value.
By default, xshippingpro calculate additional cost per 1 Unit e.g 1 KG in this case (or whatever Rate Type you defined. If you define Rate type is Quantity, then Per 1 Item) basis unless you define Per Unit Block in the last unit row.
For example, there is no Per Unit Block  defined to the last unit range row. So additional price will be calculated for per 1 KG since Rate type is Weight. Lets say Additional Price is $10, that means cost for every KG is $10
If there was Per Unit block defined to the last unit range row, it would calculate additional price per Per Unit block basis. For example, if it was defined 2, additional price would calculate per 2 KG.  Lets say Additional Price is $10, that means cost for every 2KG is $10

Let’s proceed to main discussion. Lets say we have cart weight 60KG so what would the final shipping cost according to above setting?

1.  First row:  $5
2.  Second row:  $20      (No of blocks: 10 and Cost per block: $2 ,Therefore, 10 x $2 = $20 )
3.  Third row:  $20
Yes, we have still some weight 10KG pending to be calculated  even after all unit rows are done. Because our last row’s upper limit is 50KG but our cart weight is 60KG
4. Additional Shipping Cost: $50   ( Additional Price $5 and we have 10KG to be calculated per 1 KG basis)
Since Final Price cumulative so lets sum up item 1 to 4: ( $5 +$20 + $20 + $50) = $95
Therefore, Final shipping cost for 50KG weight would be $95

Xform field validation using regular expression

xform regular expression for validation

Title Expression Example
US phone validation      /^\(?(\d{3})\)?[-\. ]?(\d{3})[-\. ]?(\d{4})$/ 555-555-1212, (555)-555-1212), 555 555 1212, 555.555.1212, (555).555.1212
UK Phone Validation  /^(\+44\s?7\d{3}|\(?\d{5}\)?)\s?\d{3}\s?\d{3}$/ 07222 555555, (07222) 555555, +44 7222 555 555
ZIP code validation    /^[0-9]{10}$/  
UK postal validation    /[A-Z]{1,2}[0-9][0-9A-Z]?\s?[0-9][A-Z]{2}/i  
Image Validation   /jpeg|png|gif|jpg/  jpg, png and gif
Image Validation with mime type   /image\/jpeg|image\/png|image\/gif|image\/jpg/  jpg, png and gif
PDF file validation  /application\/pdf|application\/x-pdf/  
Alphabet String Length   /^[a-zA-Z]{3,7}$/   Min length 3 and max length is 7
Any String Length   /^.{5,20}$/   Min length 5 and max length is 20
Restrict/Block HTML   /^(?!.*((<.*?>.*?<\/\w+>)|(:\/\/)))/  

Video tutorials on Xshippingpro

I don’t know Lee Ashby personally but I would like to give a big thanks for making few wonderful videos on X-shippingpro in his youtube channel. Lee Ashby, I owe you a cup of coffee! Thank you buddy!

Here are the video links:

X-shipping Pro Opencart Shipping Tutorial – Basic Flat Rate

X-shipping Pro Opencart Shipping Tutorial – Free Shipping

X-shipping Pro Opencart Shipping Tutorial – Groups & Geo Location

X-Shipping Pro Opencart Shipping Tutorial – Heavy Item Surcharge

 

 

 

 

First level grouping vs Second level grouping in xshippingpro

In xshippingpro, there are two levels of grouping:

  1. Group in methods – First level grouping is based on Group Field  and
  2. Group in groups – second level grouping is based on Sort Order field.

Xshippingpro first calculate grouping based on Group field and finally it calculate grouping again based on Sort Order Fields.

Second level grouping need very seldom. Most of the cases, first/top level grouping is enough to achieve the scenario. However, it might be needed second level grouping in few cases.
Why do you need grouping basically? Sometimes we came across in a situation when we have to take decision what to do to a special case. For example, You want to charge shipping cost $5 if any item is chosen from category A and shipping cost $10 when any item is chosen from Category B. But what would happen when someone want to purchase from both category A and B? Well, you may want sum the shipping cost up Or want to move on with highest Shipping cost.

You can then let xshippingpro know your decision through grouping mode. For doing so, you will have to navigate to group mode option, then Choose Group1 is Sum or whatever you want. Now, You will have to assign this group to each of the applicable shipping method in the General tab. Under general tab of the method, you will find an option “Group”. This is field where you need to be assigned it. If you don’t need any group, you can just keep it as “None”.

This way, you can make up to 10 groupings amongst the shipping methods. One method can belong to only one group at a time.

Now let discuss Group of groups or second level grouping. For example, you have 5 top level groups like I discussed above. Now you have come up in a situation where you may need to sum up the cost of  the groups. This is very rare case but it may be needed. Thats why Group of Group is only one. To make grouping within groups, you first choose Group mode i.e either it is sum or highest etc.

Then you will have to choose shipping methods for this group. Unfortunately, there is no selection field for this kind of grouping like first level grouping. Xshippingpro consider value of the Sort Order field that is located under general tab to find out or calculate such grouping. Method having same Sort order value will be considered as a group. For example,  if you have chosen “Group of groups” is Sum. Now method-A and method-B has sort order value is 1. Now xshippignpro, will consider these two method as a group. So whenever both methods shall become activate simultaneously, xshippignpro will show one method instead of both depending on Group mode (sum, average etc).

Note group in groups will not work unless you have at least one first/Top level grouping.

Shipping Cost per 100gm with additional $10

how to set following situation?

initial charge(Rate per parcel) $10
Plus rate per 100g or part thereof $1

So if customer buy an item of 300g
Total charge is $13 (1 x $10 + 3 x $1)

Thanks for your query. Please do following:

1. Under Price setting tab, Select Rate type is Weight.

I am assuming that your default weight unit is gram. If it is KG, then you will have to enter it accordingly. For example, 100 will be replaced with 0.1

Now enter following Unit Ranges:

Start . —- End . —- Cost —- per unit block —- Allow partial 
0 —- 999999 — 1 —– 100 – – — – – NO

Explanation:
——-
a. First define a big ranges 0 – 999999 so that it covers all weight
b. Per unit block ensure that it will charge $1 per 100 gram
c. Allow partial ensure that it will not charge partial block. SO it will charge $3 for 250 grams instead of $2.5

2. Under Price adjustment section, enter +10 into the field “Modifier” [+10 means it will add $10 with final cost]

Using of AND group mode in xfeepro

I do not know how to configure it.
What I need is below:
If shopping cart include any product in category A, a discount is based on percentage of  all  Category A products.
For example:
Category A include Product I of $10, product II of $5.
Category B include product III of $30
If shopping cart include
2 Product I (category A):   2*10
1 Product III (category B): 1*30
Then discount= percentage of 2*10
Could you explain to me how to setup this rule?
Thanks for contacting and using xfeepro.
Configuring conditional logic is bit complex. But this can be achieved by Group mode option. Group mode option can be found under general setting tab. Fee having same Sort order  value will consider as a group. Sort order field can be found under general tab of each method.
For conditional mode, you will have to choose Group mode is AND. Now if you create two methods and assign same sort order value, those two methods will act as a group and one method won’t be appeared unless other method become valid. Noted that in group mode AND, price will be calculated from first fee, remain fees will be used just for other condition validation.
Lets start configuration:
First, under General Setting tab, Select Group mode is AND
Since you need to calculate cost based on category A, so we will create that fee first and then will create the other fee that will be just used for validating category condition.
First fee for category A
———–
1. Create a new fee and enter a name
2.  Under General tab, enter sort order value is 1  [Or whatever but need to be entered same value into the the fee so grouping can work]
3. Under Product/Category Tab, select Category Rule is “Any of the selected categories with other”. Then choose your applicable categories for which you want to offer discount. In your case these are Category A
4. Under Price setting tab, Select Rate type is Flat and enter your discount percentile into fee cost. For example: 5%
5. Now in the same tab, Select “Percentage related to” is “Sub-total Fee specific” .   [Sub-total Fee specific ensure that xfeepro would consider the products of chosen categories only]
First fee for category B
———–
1. Create a new fee and enter a name
2.  Under General tab, enter sort order value is 1  [This must be same as previous one]
3. Under Product/Category Tab, select Category Rule is “Any of the selected categories with other”. Then choose your conditional categories In your case these are Category B
Keep other setting as their default. Since this will be used just for category conditioning thing.